<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-comment">{-
(c) The University of Glasgow 2006
(c) The GRASP/AQUA Project, Glasgow University, 1992-1998

-}</span><span>
</span><span id="line-6"></span><span>
</span><span id="line-7"></span><span class="hs-pragma">{-# LANGUAGE CPP, RankNTypes, ScopedTypeVariables #-}</span><span>
</span><span id="line-8"></span><span class="hs-pragma">{-# LANGUAGE FlexibleContexts #-}</span><span>
</span><span id="line-9"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-10"></span><span class="hs-pragma">{-# LANGUAGE ViewPatterns #-}</span><span>
</span><span id="line-11"></span><span>
</span><span id="line-12"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Tc.Gen.Bind</span><span>
</span><span id="line-13"></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcLocalBinds"><span class="hs-identifier">tcLocalBinds</span></a></span><span>
</span><span id="line-14"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcTopBinds"><span class="hs-identifier">tcTopBinds</span></a></span><span>
</span><span id="line-15"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcValBinds"><span class="hs-identifier">tcValBinds</span></a></span><span>
</span><span id="line-16"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcHsBootSigs"><span class="hs-identifier">tcHsBootSigs</span></a></span><span>
</span><span id="line-17"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcPolyCheck"><span class="hs-identifier">tcPolyCheck</span></a></span><span>
</span><span id="line-18"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#chooseInferredQuantifiers"><span class="hs-identifier">chooseInferredQuantifiers</span></a></span><span>
</span><span id="line-19"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#badBootDeclErr"><span class="hs-identifier">badBootDeclErr</span></a></span><span>
</span><span id="line-20"></span><span>   </span><span class="hs-special">)</span><span>
</span><span id="line-21"></span><span class="hs-keyword">where</span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-24"></span><span>
</span><span id="line-25"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Match.html"><span class="hs-identifier">GHC.Tc.Gen.Match</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Match.html#tcGRHSsPat"><span class="hs-identifier">tcGRHSsPat</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Match.html#tcMatchesFun"><span class="hs-identifier">tcMatchesFun</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Expr.html"><span class="hs-identifier">GHC.Tc.Gen.Expr</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Expr.html#tcCheckMonoExpr"><span class="hs-identifier">tcCheckMonoExpr</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="hs-pragma">{-# SOURCE</span><span> </span><span class="hs-pragma">#-}</span><span> </span><span class="annot"><a href="GHC.Tc.TyCl.PatSyn.html"><span class="hs-identifier">GHC.Tc.TyCl.PatSyn</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.TyCl.PatSyn.html#tcPatSynDecl"><span class="hs-identifier">tcPatSynDecl</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.TyCl.PatSyn.html#tcPatSynBuilderBind"><span class="hs-identifier">tcPatSynBuilderBind</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-28"></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.html"><span class="hs-identifier">GHC.Core</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.html#Tickish"><span class="hs-identifier">Tickish</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html"><span class="hs-identifier">GHC.Types.CostCentre</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.CostCentre.html#mkUserCC"><span class="hs-identifier">mkUserCC</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.CostCentre.html#CCFlavour"><span class="hs-identifier">CCFlavour</span></a></span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.CostCentre.html#DeclCC"><span class="hs-identifier">DeclCC</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html"><span class="hs-identifier">GHC.Tc.Gen.Sig</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html"><span class="hs-identifier">GHC.Tc.Utils.Monad</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Origin.html"><span class="hs-identifier">GHC.Tc.Types.Origin</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Env.html"><span class="hs-identifier">GHC.Tc.Utils.Env</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Unify.html"><span class="hs-identifier">GHC.Tc.Utils.Unify</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Solver.html"><span class="hs-identifier">GHC.Tc.Solver</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Types.Evidence.html"><span class="hs-identifier">GHC.Tc.Types.Evidence</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.HsType.html"><span class="hs-identifier">GHC.Tc.Gen.HsType</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html"><span class="hs-identifier">GHC.Tc.Gen.Pat</span></a></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcMType.html"><span class="hs-identifier">GHC.Tc.Utils.TcMType</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Multiplicity.html"><span class="hs-identifier">GHC.Core.Multiplicity</span></a></span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html"><span class="hs-identifier">GHC.Core.FamInstEnv</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.FamInstEnv.html#normaliseType"><span class="hs-identifier">normaliseType</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Family.html"><span class="hs-identifier">GHC.Tc.Instance.Family</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Instance.Family.html#tcGetFamInstEnvs"><span class="hs-identifier">tcGetFamInstEnvs</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html"><span class="hs-identifier">GHC.Tc.Utils.TcType</span></a></span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.Type.html#mkStrLitTy"><span class="hs-identifier">mkStrLitTy</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Tidy.html#tidyOpenType"><span class="hs-identifier">tidyOpenType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier">splitTyConApp_maybe</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#mkCastTy"><span class="hs-identifier">mkCastTy</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.Prim.html"><span class="hs-identifier">GHC.Builtin.Types.Prim</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html"><span class="hs-identifier">GHC.Builtin.Types</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Builtin.Types.html#mkBoxedTupleTy"><span class="hs-identifier">mkBoxedTupleTy</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.html"><span class="hs-identifier">GHC.Types.Var</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Var</span></span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html"><span class="hs-identifier">GHC.Types.Var.Set</span></a></span><span>
</span><span id="line-55"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html"><span class="hs-identifier">GHC.Types.Var.Env</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#TidyEnv"><span class="hs-identifier">TidyEnv</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html"><span class="hs-identifier">GHC.Types.Name.Set</span></a></span><span>
</span><span id="line-59"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html"><span class="hs-identifier">GHC.Types.Name.Env</span></a></span><span>
</span><span id="line-60"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-61"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html"><span class="hs-identifier">GHC.Data.Bag</span></a></span><span>
</span><span id="line-62"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span>
</span><span id="line-63"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Graph.Directed.html"><span class="hs-identifier">GHC.Data.Graph.Directed</span></a></span><span>
</span><span id="line-64"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html"><span class="hs-identifier">GHC.Data.Maybe</span></a></span><span>
</span><span id="line-65"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-66"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-67"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Outputable</span></span><span>
</span><span id="line-68"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html#ipClassName"><span class="hs-identifier">ipClassName</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-69"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Validity.html"><span class="hs-identifier">GHC.Tc.Validity</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Validity.html#checkValidType"><span class="hs-identifier">checkValidType</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-70"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.FM.html"><span class="hs-identifier">GHC.Types.Unique.FM</span></a></span><span>
</span><span id="line-71"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Unique.Set.html"><span class="hs-identifier">GHC.Types.Unique.Set</span></a></span><span>
</span><span id="line-72"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.LanguageExtensions.html#"><span class="hs-identifier">GHC.LanguageExtensions</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">LangExt</span></span><span>
</span><span id="line-73"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html"><span class="hs-identifier">GHC.Core.ConLike</span></a></span><span>
</span><span id="line-74"></span><span>
</span><span id="line-75"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-76"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Foldable.html#"><span class="hs-identifier">Data.Foldable</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Foldable.html#find"><span class="hs-identifier">find</span></a></span><span class="hs-special">)</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-80"></span><span class="hs-comment">{-
************************************************************************
*                                                                      *
\subsection{Type-checking bindings}
*                                                                      *
************************************************************************

@tcBindsAndThen@ typechecks a @HsBinds@.  The &quot;and then&quot; part is because
it needs to know something about the {\em usage} of the things bound,
so that it can create specialisations of them.  So @tcBindsAndThen@
takes a function which, given an extended environment, E, typechecks
the scope of the bindings returning a typechecked thing and (most
important) an LIE.  It is this LIE which is then used as the basis for
specialising the things bound.

@tcBindsAndThen@ also takes a &quot;combiner&quot; which glues together the
bindings and the &quot;thing&quot; to make a new &quot;thing&quot;.

The real work is done by @tcBindWithSigsAndThen@.

Recursive and non-recursive binds are handled in essentially the same
way: because of uniques there are no scoping issues left.  The only
difference is that non-recursive bindings can bind primitive values.

Even for non-recursive binding groups we add typings for each binder
to the LVE for the following reason.  When each individual binding is
checked the type of its LHS is unified with that of its RHS; and
type-checking the LHS of course requires that the binder is in scope.

At the top-level the LIE is sure to contain nothing but constant
dictionaries, which we resolve at the module level.

Note [Polymorphic recursion]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The game plan for polymorphic recursion in the code above is

        * Bind any variable for which we have a type signature
          to an Id with a polymorphic type.  Then when type-checking
          the RHSs we'll make a full polymorphic call.

This fine, but if you aren't a bit careful you end up with a horrendous
amount of partial application and (worse) a huge space leak. For example:

        f :: Eq a =&gt; [a] -&gt; [a]
        f xs = ...f...

If we don't take care, after typechecking we get

        f = /\a -&gt; \d::Eq a -&gt; let f' = f a d
                               in
                               \ys:[a] -&gt; ...f'...

Notice the stupid construction of (f a d), which is of course
identical to the function we're executing.  In this case, the
polymorphic recursion isn't being used (but that's a very common case).
This can lead to a massive space leak, from the following top-level defn
(post-typechecking)

        ff :: [Int] -&gt; [Int]
        ff = f Int dEqInt

Now (f dEqInt) evaluates to a lambda that has f' as a free variable; but
f' is another thunk which evaluates to the same thing... and you end
up with a chain of identical values all hung onto by the CAF ff.

        ff = f Int dEqInt

           = let f' = f Int dEqInt in \ys. ...f'...

           = let f' = let f' = f Int dEqInt in \ys. ...f'...
                      in \ys. ...f'...

Etc.

NOTE: a bit of arity analysis would push the (f a d) inside the (\ys...),
which would make the space leak go away in this case

Solution: when typechecking the RHSs we always have in hand the
*monomorphic* Ids for each binding.  So we just need to make sure that
if (Method f a d) shows up in the constraints emerging from (...f...)
we just use the monomorphic Id.  We achieve this by adding monomorphic Ids
to the &quot;givens&quot; when simplifying constraints.  That's what the &quot;lies_avail&quot;
is doing.

Then we get

        f = /\a -&gt; \d::Eq a -&gt; letrec
                                 fm = \ys:[a] -&gt; ...fm...
                               in
                               fm
-}</span><span>
</span><span id="line-171"></span><span>
</span><span id="line-172"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcTopBinds"><span class="hs-identifier hs-type">tcTopBinds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Binds.html#LSig"><span class="hs-identifier hs-type">LSig</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-173"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcGblEnv"><span class="hs-identifier hs-type">TcGblEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcLclEnv"><span class="hs-identifier hs-type">TcLclEnv</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-174"></span><span class="hs-comment">-- The TcGblEnv contains the new tcg_binds and tcg_spects</span><span>
</span><span id="line-175"></span><span class="hs-comment">-- The TcLclEnv has an extended type envt for the new bindings</span><span>
</span><span id="line-176"></span><span id="tcTopBinds"><span class="annot"><span class="annottext">tcTopBinds :: [(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; [LSig (GhcPass 'Renamed)] -&gt; TcM (TcGblEnv, TcLclEnv)
</span><a href="GHC.Tc.Gen.Bind.html#tcTopBinds"><span class="hs-identifier hs-var hs-var">tcTopBinds</span></a></span></span><span> </span><span id="local-6989586621681098656"><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098656"><span class="hs-identifier hs-var">binds</span></a></span></span><span> </span><span id="local-6989586621681098655"><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098655"><span class="hs-identifier hs-var">sigs</span></a></span></span><span>
</span><span id="line-177"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-comment">-- Pattern synonym bindings populate the global environment</span><span>
</span><span id="line-178"></span><span>          </span><span class="hs-special">(</span><span id="local-6989586621681098654"><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098654"><span class="hs-identifier hs-var">binds'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098653"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681098653"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098652"><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681098652"><span class="hs-identifier hs-var">tcl_env</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
-&gt; [(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; [LSig (GhcPass 'Renamed)]
-&gt; TcM (TcGblEnv, TcLclEnv)
-&gt; TcM
     ([(RecFlag, LHsBinds (GhcPass 'Typechecked))],
      (TcGblEnv, TcLclEnv))
forall thing.
TopLevelFlag
-&gt; [(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; [LSig (GhcPass 'Renamed)]
-&gt; TcM thing
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
</span><a href="GHC.Tc.Gen.Bind.html#tcValBinds"><span class="hs-identifier hs-var">tcValBinds</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="GHC.Types.Basic.html#TopLevel"><span class="hs-identifier hs-var">TopLevel</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098656"><span class="hs-identifier hs-var">binds</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098655"><span class="hs-identifier hs-var">sigs</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM (TcGblEnv, TcLclEnv)
 -&gt; TcM
      ([(RecFlag, LHsBinds (GhcPass 'Typechecked))],
       (TcGblEnv, TcLclEnv)))
-&gt; TcM (TcGblEnv, TcLclEnv)
-&gt; TcM
     ([(RecFlag, LHsBinds (GhcPass 'Typechecked))],
      (TcGblEnv, TcLclEnv))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-179"></span><span>            </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681098650"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681098650"><span class="hs-identifier hs-var">gbl</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv TcGblEnv
forall gbl lcl. TcRnIf gbl lcl gbl
</span><a href="GHC.Tc.Utils.Monad.html#getGblEnv"><span class="hs-identifier hs-var">getGblEnv</span></a></span><span>
</span><span id="line-180"></span><span>               </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098648"><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681098648"><span class="hs-identifier hs-var">lcl</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRnIf TcGblEnv TcLclEnv TcLclEnv
forall gbl lcl. TcRnIf gbl lcl lcl
</span><a href="GHC.Tc.Utils.Monad.html#getLclEnv"><span class="hs-identifier hs-var">getLclEnv</span></a></span><span>
</span><span id="line-181"></span><span>               </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TcGblEnv, TcLclEnv) -&gt; TcM (TcGblEnv, TcLclEnv)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681098650"><span class="hs-identifier hs-var">gbl</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681098648"><span class="hs-identifier hs-var">lcl</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-182"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098646"><span class="annot"><span class="annottext">[LTcSpecPrag]
</span><a href="#local-6989586621681098646"><span class="hs-identifier hs-var">specs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)] -&gt; TcM [LTcSpecPrag]
</span><a href="GHC.Tc.Gen.Sig.html#tcImpPrags"><span class="hs-identifier hs-var">tcImpPrags</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098655"><span class="hs-identifier hs-var">sigs</span></a></span><span>   </span><span class="hs-comment">-- SPECIALISE prags for imported Ids</span><span>
</span><span id="line-183"></span><span>
</span><span id="line-184"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098644"><span class="annot"><span class="annottext">[CompleteMatch]
</span><a href="#local-6989586621681098644"><span class="hs-identifier hs-var">complete_matches</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(TcGblEnv, TcLclEnv)
-&gt; TcRnIf TcGblEnv TcLclEnv [CompleteMatch]
-&gt; TcRnIf TcGblEnv TcLclEnv [CompleteMatch]
forall gbl' lcl' a gbl lcl.
(gbl', lcl') -&gt; TcRnIf gbl' lcl' a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setEnvs"><span class="hs-identifier hs-var">setEnvs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681098653"><span class="hs-identifier hs-var">tcg_env</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681098652"><span class="hs-identifier hs-var">tcl_env</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcRnIf TcGblEnv TcLclEnv [CompleteMatch]
 -&gt; TcRnIf TcGblEnv TcLclEnv [CompleteMatch])
-&gt; TcRnIf TcGblEnv TcLclEnv [CompleteMatch]
-&gt; TcRnIf TcGblEnv TcLclEnv [CompleteMatch]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
-&gt; TcRnIf TcGblEnv TcLclEnv [CompleteMatch]
</span><a href="GHC.Tc.Gen.Bind.html#tcCompleteSigs"><span class="hs-identifier hs-var">tcCompleteSigs</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098655"><span class="hs-identifier hs-var">sigs</span></a></span><span>
</span><span id="line-185"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;complete_matches&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098656"><span class="hs-identifier hs-var">binds</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098655"><span class="hs-identifier hs-var">sigs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-186"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;complete_matches&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[CompleteMatch] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[CompleteMatch]
</span><a href="#local-6989586621681098644"><span class="hs-identifier hs-var">complete_matches</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-187"></span><span>
</span><span id="line-188"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681098638"><span class="annot"><span class="annottext">tcg_env' :: TcGblEnv
</span><a href="#local-6989586621681098638"><span class="hs-identifier hs-var hs-var">tcg_env'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681098653"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tcg_imp_specs :: [LTcSpecPrag]
</span><a href="GHC.Tc.Types.html#tcg_imp_specs"><span class="hs-identifier hs-var">tcg_imp_specs</span></a></span><span>
</span><span id="line-189"></span><span>                                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LTcSpecPrag]
</span><a href="#local-6989586621681098646"><span class="hs-identifier hs-var">specs</span></a></span><span> </span><span class="annot"><span class="annottext">[LTcSpecPrag] -&gt; [LTcSpecPrag] -&gt; [LTcSpecPrag]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; [LTcSpecPrag]
</span><a href="GHC.Tc.Types.html#tcg_imp_specs"><span class="hs-identifier hs-var hs-var">tcg_imp_specs</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681098653"><span class="hs-identifier hs-var">tcg_env</span></a></span><span>
</span><span id="line-190"></span><span>                                   </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">tcg_complete_matches :: [CompleteMatch]
</span><a href="GHC.Tc.Types.html#tcg_complete_matches"><span class="hs-identifier hs-var">tcg_complete_matches</span></a></span><span>
</span><span id="line-191"></span><span>                                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[CompleteMatch]
</span><a href="#local-6989586621681098644"><span class="hs-identifier hs-var">complete_matches</span></a></span><span>
</span><span id="line-192"></span><span>                                          </span><span class="annot"><span class="annottext">[CompleteMatch] -&gt; [CompleteMatch] -&gt; [CompleteMatch]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; [CompleteMatch]
</span><a href="GHC.Tc.Types.html#tcg_complete_matches"><span class="hs-identifier hs-var hs-var">tcg_complete_matches</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681098653"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-193"></span><span>                           </span><span class="annot"><span class="annottext">TcGblEnv -&gt; [LHsBinds (GhcPass 'Typechecked)] -&gt; TcGblEnv
</span><a href="GHC.Tc.Utils.Env.html#addTypecheckedBinds"><span class="hs-operator hs-var">`addTypecheckedBinds`</span></a></span><span> </span><span class="annot"><span class="annottext">((RecFlag, LHsBinds (GhcPass 'Typechecked))
 -&gt; LHsBinds (GhcPass 'Typechecked))
-&gt; [(RecFlag, LHsBinds (GhcPass 'Typechecked))]
-&gt; [LHsBinds (GhcPass 'Typechecked)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(RecFlag, LHsBinds (GhcPass 'Typechecked))
-&gt; LHsBinds (GhcPass 'Typechecked)
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098654"><span class="hs-identifier hs-var">binds'</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-194"></span><span>
</span><span id="line-195"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TcGblEnv, TcLclEnv) -&gt; TcM (TcGblEnv, TcLclEnv)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681098638"><span class="hs-identifier hs-var">tcg_env'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcLclEnv
</span><a href="#local-6989586621681098652"><span class="hs-identifier hs-var">tcl_env</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-196"></span><span>        </span><span class="hs-comment">-- The top level bindings are flattened into a giant</span><span>
</span><span id="line-197"></span><span>        </span><span class="hs-comment">-- implicitly-mutually-recursive LHsBinds</span><span>
</span><span id="line-198"></span><span>
</span><span id="line-199"></span><span>
</span><span id="line-200"></span><span class="hs-comment">-- Note [Typechecking Complete Matches]</span><span>
</span><span id="line-201"></span><span class="hs-comment">-- Much like when a user bundled a pattern synonym, the result types of</span><span>
</span><span id="line-202"></span><span class="hs-comment">-- all the constructors in the match pragma must be consistent.</span><span>
</span><span id="line-203"></span><span class="hs-comment">--</span><span>
</span><span id="line-204"></span><span class="hs-comment">-- If we allowed pragmas with inconsistent types then it would be</span><span>
</span><span id="line-205"></span><span class="hs-comment">-- impossible to ever match every constructor in the list and so</span><span>
</span><span id="line-206"></span><span class="hs-comment">-- the pragma would be useless.</span><span>
</span><span id="line-207"></span><span>
</span><span id="line-208"></span><span>
</span><span id="line-209"></span><span>
</span><span id="line-210"></span><span>
</span><span id="line-211"></span><span>
</span><span id="line-212"></span><span class="hs-comment">-- This is only used in `tcCompleteSig`. We fold over all the conlikes,</span><span>
</span><span id="line-213"></span><span class="hs-comment">-- this accumulator keeps track of the first `ConLike` with a concrete</span><span>
</span><span id="line-214"></span><span class="hs-comment">-- return type. After fixing the return type, all other constructors with</span><span>
</span><span id="line-215"></span><span class="hs-comment">-- a fixed return type must agree with this.</span><span>
</span><span id="line-216"></span><span class="hs-comment">--</span><span>
</span><span id="line-217"></span><span class="hs-comment">-- The fields of `Fixed` cache the first conlike and its return type so</span><span>
</span><span id="line-218"></span><span class="hs-comment">-- that we can compare all the other conlikes to it. The conlike is</span><span>
</span><span id="line-219"></span><span class="hs-comment">-- stored for error messages.</span><span>
</span><span id="line-220"></span><span class="hs-comment">--</span><span>
</span><span id="line-221"></span><span class="hs-comment">-- `Nothing` in the case that the type is fixed by a type signature</span><span>
</span><span id="line-222"></span><span class="hs-keyword">data</span><span> </span><span id="CompleteSigType"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#CompleteSigType"><span class="hs-identifier hs-var">CompleteSigType</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="AcceptAny"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#AcceptAny"><span class="hs-identifier hs-var">AcceptAny</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="Fixed"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#Fixed"><span class="hs-identifier hs-var">Fixed</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html#ConLike"><span class="hs-identifier hs-type">ConLike</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>
</span><span id="line-223"></span><span>
</span><span id="line-224"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcCompleteSigs"><span class="hs-identifier hs-type">tcCompleteSigs</span></a></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Binds.html#LSig"><span class="hs-identifier hs-type">LSig</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Driver.Types.html#CompleteMatch"><span class="hs-identifier hs-type">CompleteMatch</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-225"></span><span id="tcCompleteSigs"><span class="annot"><span class="annottext">tcCompleteSigs :: [LSig (GhcPass 'Renamed)]
-&gt; TcRnIf TcGblEnv TcLclEnv [CompleteMatch]
</span><a href="GHC.Tc.Gen.Bind.html#tcCompleteSigs"><span class="hs-identifier hs-var hs-var">tcCompleteSigs</span></a></span></span><span> </span><span id="local-6989586621681098632"><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098632"><span class="hs-identifier hs-var">sigs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-226"></span><span>  </span><span class="hs-keyword">let</span><span>
</span><span id="line-227"></span><span>      </span><span class="annot"><a href="#local-6989586621681098631"><span class="hs-identifier hs-type">doOne</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#Sig"><span class="hs-identifier hs-type">Sig</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#CompleteMatch"><span class="hs-identifier hs-type">CompleteMatch</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-228"></span><span>      </span><span id="local-6989586621681098631"><span class="annot"><span class="annottext">doOne :: Sig (GhcPass 'Renamed) -&gt; TcM (Maybe CompleteMatch)
</span><a href="#local-6989586621681098631"><span class="hs-identifier hs-var hs-var">doOne</span></a></span></span><span> </span><span id="local-6989586621681098630"><span class="annot"><span class="annottext">c :: Sig (GhcPass 'Renamed)
</span><a href="#local-6989586621681098630"><span class="hs-identifier hs-var">c</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#CompleteMatchSig"><span class="hs-identifier hs-type">CompleteMatchSig</span></a></span><span> </span><span class="annot"><span class="annottext">XCompleteMatchSig (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">SourceText
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681098628"><span class="annot"><span class="annottext">Located [Located (IdP (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098628"><span class="hs-identifier hs-var">lns</span></a></span></span><span> </span><span id="local-6989586621681098627"><span class="annot"><span class="annottext">Maybe (Located (IdP (GhcPass 'Renamed)))
</span><a href="#local-6989586621681098627"><span class="hs-identifier hs-var">mtc</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-229"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(CompleteMatch -&gt; Maybe CompleteMatch)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
-&gt; TcM (Maybe CompleteMatch)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">CompleteMatch -&gt; Maybe CompleteMatch
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
 -&gt; TcM (Maybe CompleteMatch))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
-&gt; TcM (Maybe CompleteMatch)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-230"></span><span>           </span><span class="annot"><span class="annottext">SDoc
-&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
-&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
forall a. SDoc -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#addErrCtxt"><span class="hs-identifier hs-var">addErrCtxt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;In&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Sig (GhcPass 'Renamed) -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Sig (GhcPass 'Renamed)
</span><a href="#local-6989586621681098630"><span class="hs-identifier hs-var">c</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
-&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-231"></span><span>            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe (Located (IdP (GhcPass 'Renamed)))
</span><a href="#local-6989586621681098627"><span class="hs-identifier hs-var">mtc</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-232"></span><span>              </span><span class="annot"><span class="annottext">Maybe (Located (IdP (GhcPass 'Renamed)))
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
</span><a href="#local-6989586621681098623"><span class="hs-identifier hs-var">infer_complete_match</span></a></span><span>
</span><span id="line-233"></span><span>              </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681098622"><span class="annot"><span class="annottext">Located (IdP (GhcPass 'Renamed))
</span><a href="#local-6989586621681098622"><span class="hs-identifier hs-var">tc</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Located Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
</span><a href="#local-6989586621681098621"><span class="hs-identifier hs-var">check_complete_match</span></a></span><span> </span><span class="annot"><span class="annottext">Located Name
Located (IdP (GhcPass 'Renamed))
</span><a href="#local-6989586621681098622"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-234"></span><span>        </span><span class="hs-keyword">where</span><span>
</span><span id="line-235"></span><span>
</span><span id="line-236"></span><span>          </span><span id="local-6989586621681098620"><span class="annot"><span class="annottext">checkCLTypes :: CompleteSigType
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
</span><a href="#local-6989586621681098620"><span class="hs-identifier hs-var hs-var">checkCLTypes</span></a></span></span><span> </span><span id="local-6989586621681098619"><span class="annot"><span class="annottext">CompleteSigType
</span><a href="#local-6989586621681098619"><span class="hs-identifier hs-var">acc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((CompleteSigType, [ConLike])
 -&gt; Located Name
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike]))
-&gt; (CompleteSigType, [ConLike])
-&gt; [Located Name]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
forall (t :: * -&gt; *) (m :: * -&gt; *) b a.
(Foldable t, Monad m) =&gt;
(b -&gt; a -&gt; m b) -&gt; b -&gt; t a -&gt; m b
</span><a href="../../base/src/Control.Monad.html#foldM"><span class="hs-identifier hs-var">foldM</span></a></span><span> </span><span class="annot"><span class="annottext">(CompleteSigType, [ConLike])
-&gt; Located Name
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
</span><a href="#local-6989586621681098617"><span class="hs-identifier hs-var">checkCLType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CompleteSigType
</span><a href="#local-6989586621681098619"><span class="hs-identifier hs-var">acc</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated SrcSpan [Located Name] -&gt; [Located Name]
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan [Located Name]
Located [Located (IdP (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098628"><span class="hs-identifier hs-var">lns</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-237"></span><span>
</span><span id="line-238"></span><span>          </span><span id="local-6989586621681098623"><span class="annot"><span class="annottext">infer_complete_match :: IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
</span><a href="#local-6989586621681098623"><span class="hs-identifier hs-var hs-var">infer_complete_match</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-239"></span><span>            </span><span class="hs-special">(</span><span id="local-6989586621681098615"><span class="annot"><span class="annottext">CompleteSigType
</span><a href="#local-6989586621681098615"><span class="hs-identifier hs-var">res</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098614"><span class="annot"><span class="annottext">[ConLike]
</span><a href="#local-6989586621681098614"><span class="hs-identifier hs-var">cls</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CompleteSigType
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
</span><a href="#local-6989586621681098620"><span class="hs-identifier hs-var">checkCLTypes</span></a></span><span> </span><span class="annot"><span class="annottext">CompleteSigType
</span><a href="GHC.Tc.Gen.Bind.html#AcceptAny"><span class="hs-identifier hs-var">AcceptAny</span></a></span><span>
</span><span id="line-240"></span><span>            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">CompleteSigType
</span><a href="#local-6989586621681098615"><span class="hs-identifier hs-var">res</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-241"></span><span>              </span><span class="annot"><span class="annottext">CompleteSigType
</span><a href="GHC.Tc.Gen.Bind.html#AcceptAny"><span class="hs-identifier hs-var">AcceptAny</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
forall a. SDoc -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#failWithTc"><span class="hs-identifier hs-var">failWithTc</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681098612"><span class="hs-identifier hs-var">ambiguousError</span></a></span><span>
</span><span id="line-242"></span><span>              </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#Fixed"><span class="hs-identifier hs-type">Fixed</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe ConLike
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681098611"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098611"><span class="hs-identifier hs-var">tc</span></a></span></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">CompleteMatch -&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(CompleteMatch -&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch)
-&gt; CompleteMatch -&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[ConLike] -&gt; TyCon -&gt; CompleteMatch
</span><a href="#local-6989586621681098610"><span class="hs-identifier hs-var">mkMatch</span></a></span><span> </span><span class="annot"><span class="annottext">[ConLike]
</span><a href="#local-6989586621681098614"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098611"><span class="hs-identifier hs-var">tc</span></a></span><span>
</span><span id="line-243"></span><span>
</span><span id="line-244"></span><span>          </span><span id="local-6989586621681098621"><span class="annot"><span class="annottext">check_complete_match :: Located Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
</span><a href="#local-6989586621681098621"><span class="hs-identifier hs-var hs-var">check_complete_match</span></a></span></span><span> </span><span id="local-6989586621681098609"><span class="annot"><span class="annottext">Located Name
</span><a href="#local-6989586621681098609"><span class="hs-identifier hs-var">tc_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-245"></span><span>            </span><span id="local-6989586621681098608"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098608"><span class="hs-identifier hs-var">ty_con</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Located Name -&gt; TcM TyCon
</span><a href="GHC.Tc.Utils.Env.html#tcLookupLocatedTyCon"><span class="hs-identifier hs-var">tcLookupLocatedTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">Located Name
</span><a href="#local-6989586621681098609"><span class="hs-identifier hs-var">tc_name</span></a></span><span>
</span><span id="line-246"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CompleteSigType
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098606"><span class="annot"><span class="annottext">[ConLike]
</span><a href="#local-6989586621681098606"><span class="hs-identifier hs-var">cls</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CompleteSigType
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
</span><a href="#local-6989586621681098620"><span class="hs-identifier hs-var">checkCLTypes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe ConLike -&gt; TyCon -&gt; CompleteSigType
</span><a href="GHC.Tc.Gen.Bind.html#Fixed"><span class="hs-identifier hs-var">Fixed</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe ConLike
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098608"><span class="hs-identifier hs-var">ty_con</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-247"></span><span>            </span><span class="annot"><span class="annottext">CompleteMatch -&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(CompleteMatch -&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch)
-&gt; CompleteMatch -&gt; IOEnv (Env TcGblEnv TcLclEnv) CompleteMatch
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[ConLike] -&gt; TyCon -&gt; CompleteMatch
</span><a href="#local-6989586621681098610"><span class="hs-identifier hs-var">mkMatch</span></a></span><span> </span><span class="annot"><span class="annottext">[ConLike]
</span><a href="#local-6989586621681098606"><span class="hs-identifier hs-var">cls</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098608"><span class="hs-identifier hs-var">ty_con</span></a></span><span>
</span><span id="line-248"></span><span>
</span><span id="line-249"></span><span>          </span><span class="annot"><a href="#local-6989586621681098610"><span class="hs-identifier hs-type">mkMatch</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.ConLike.html#ConLike"><span class="hs-identifier hs-type">ConLike</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#CompleteMatch"><span class="hs-identifier hs-type">CompleteMatch</span></a></span><span>
</span><span id="line-250"></span><span>          </span><span id="local-6989586621681098610"><span class="annot"><span class="annottext">mkMatch :: [ConLike] -&gt; TyCon -&gt; CompleteMatch
</span><a href="#local-6989586621681098610"><span class="hs-identifier hs-var hs-var">mkMatch</span></a></span></span><span> </span><span id="local-6989586621681098605"><span class="annot"><span class="annottext">[ConLike]
</span><a href="#local-6989586621681098605"><span class="hs-identifier hs-var">cls</span></a></span></span><span> </span><span id="local-6989586621681098604"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098604"><span class="hs-identifier hs-var">ty_con</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CompleteMatch :: [Name] -&gt; Name -&gt; CompleteMatch
</span><a href="GHC.Driver.Types.html#CompleteMatch"><span class="hs-identifier hs-type">CompleteMatch</span></a></span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-251"></span><span>            </span><span class="hs-comment">-- foldM is a left-fold and will have accumulated the ConLikes in</span><span>
</span><span id="line-252"></span><span>            </span><span class="hs-comment">-- the reverse order. foldrM would accumulate in the correct order,</span><span>
</span><span id="line-253"></span><span>            </span><span class="hs-comment">-- but would type-check the last ConLike first, which might also be</span><span>
</span><span id="line-254"></span><span>            </span><span class="hs-comment">-- confusing from the user's perspective. Hence reverse here.</span><span>
</span><span id="line-255"></span><span>            </span><span class="annot"><span class="annottext">completeMatchConLikes :: [Name]
</span><a href="GHC.Driver.Types.html#completeMatchConLikes"><span class="hs-identifier hs-var">completeMatchConLikes</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Name] -&gt; [Name]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(ConLike -&gt; Name) -&gt; [ConLike] -&gt; [Name]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike -&gt; Name
</span><a href="GHC.Core.ConLike.html#conLikeName"><span class="hs-identifier hs-var">conLikeName</span></a></span><span> </span><span class="annot"><span class="annottext">[ConLike]
</span><a href="#local-6989586621681098605"><span class="hs-identifier hs-var">cls</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-256"></span><span>            </span><span class="annot"><span class="annottext">completeMatchTyCon :: Name
</span><a href="GHC.Driver.Types.html#completeMatchTyCon"><span class="hs-identifier hs-var">completeMatchTyCon</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; Name
</span><a href="GHC.Core.TyCon.html#tyConName"><span class="hs-identifier hs-var hs-var">tyConName</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098604"><span class="hs-identifier hs-var">ty_con</span></a></span><span>
</span><span id="line-257"></span><span>            </span><span class="hs-special">}</span><span>
</span><span id="line-258"></span><span>      </span><span class="annot"><a href="#local-6989586621681098631"><span class="hs-identifier hs-var">doOne</span></a></span><span> </span><span class="annot"><span class="annottext">Sig (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe CompleteMatch -&gt; TcM (Maybe CompleteMatch)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe CompleteMatch
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-259"></span><span>
</span><span id="line-260"></span><span>      </span><span class="annot"><a href="#local-6989586621681098612"><span class="hs-identifier hs-type">ambiguousError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-261"></span><span>      </span><span id="local-6989586621681098612"><span class="annot"><span class="annottext">ambiguousError :: SDoc
</span><a href="#local-6989586621681098612"><span class="hs-identifier hs-var hs-var">ambiguousError</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-262"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;A type signature must be provided for a set of polymorphic&quot;</span></span><span>
</span><span id="line-263"></span><span>          </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;pattern synonyms.&quot;</span></span><span>
</span><span id="line-264"></span><span>
</span><span id="line-265"></span><span>
</span><span id="line-266"></span><span>      </span><span class="hs-comment">-- See note [Typechecking Complete Matches]</span><span>
</span><span id="line-267"></span><span>      </span><span class="annot"><a href="#local-6989586621681098617"><span class="hs-identifier hs-type">checkCLType</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#CompleteSigType"><span class="hs-identifier hs-type">CompleteSigType</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.ConLike.html#ConLike"><span class="hs-identifier hs-type">ConLike</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>
</span><span id="line-268"></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#CompleteSigType"><span class="hs-identifier hs-type">CompleteSigType</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.ConLike.html#ConLike"><span class="hs-identifier hs-type">ConLike</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-269"></span><span>      </span><span id="local-6989586621681098617"><span class="annot"><span class="annottext">checkCLType :: (CompleteSigType, [ConLike])
-&gt; Located Name
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
</span><a href="#local-6989586621681098617"><span class="hs-identifier hs-var hs-var">checkCLType</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098597"><span class="annot"><span class="annottext">CompleteSigType
</span><a href="#local-6989586621681098597"><span class="hs-identifier hs-var">cst</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098596"><span class="annot"><span class="annottext">[ConLike]
</span><a href="#local-6989586621681098596"><span class="hs-identifier hs-var">cs</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681098595"><span class="annot"><span class="annottext">Located Name
</span><a href="#local-6989586621681098595"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-270"></span><span>        </span><span id="local-6989586621681098594"><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681098594"><span class="hs-identifier hs-var">cl</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; TcM ConLike) -&gt; Located Name -&gt; TcM ConLike
forall a b. (a -&gt; TcM b) -&gt; Located a -&gt; TcM b
</span><a href="GHC.Tc.Utils.Monad.html#addLocM"><span class="hs-identifier hs-var">addLocM</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM ConLike
</span><a href="GHC.Tc.Utils.Env.html#tcLookupConLike"><span class="hs-identifier hs-var">tcLookupConLike</span></a></span><span> </span><span class="annot"><span class="annottext">Located Name
</span><a href="#local-6989586621681098595"><span class="hs-identifier hs-var">n</span></a></span><span>
</span><span id="line-271"></span><span>        </span><span class="hs-keyword">let</span><span>   </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TcId]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[TcId]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[EqSpec]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">TcThetaType
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">TcThetaType
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">[Scaled Kind]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098591"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098591"><span class="hs-identifier hs-var">res_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ConLike
-&gt; ([TcId], [TcId], [EqSpec], TcThetaType, TcThetaType,
    [Scaled Kind], Kind)
</span><a href="GHC.Core.ConLike.html#conLikeFullSig"><span class="hs-identifier hs-var">conLikeFullSig</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681098594"><span class="hs-identifier hs-var">cl</span></a></span><span>
</span><span id="line-272"></span><span>              </span><span id="local-6989586621681098589"><span class="annot"><span class="annottext">res_ty_con :: Maybe TyCon
</span><a href="#local-6989586621681098589"><span class="hs-identifier hs-var hs-var">res_ty_con</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TyCon, TcThetaType) -&gt; TyCon
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">((TyCon, TcThetaType) -&gt; TyCon)
-&gt; Maybe (TyCon, TcThetaType) -&gt; Maybe TyCon
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Kind -&gt; Maybe (TyCon, TcThetaType)
Kind -&gt; Maybe (TyCon, TcThetaType)
</span><a href="GHC.Core.Type.html#splitTyConApp_maybe"><span class="hs-identifier hs-var">splitTyConApp_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098591"><span class="hs-identifier hs-var">res_ty</span></a></span><span>
</span><span id="line-273"></span><span>        </span><span class="hs-keyword">case</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CompleteSigType
</span><a href="#local-6989586621681098597"><span class="hs-identifier hs-var">cst</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe TyCon
</span><a href="#local-6989586621681098589"><span class="hs-identifier hs-var">res_ty_con</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-274"></span><span>          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CompleteSigType
</span><a href="GHC.Tc.Gen.Bind.html#AcceptAny"><span class="hs-identifier hs-var">AcceptAny</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe TyCon
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(CompleteSigType, [ConLike])
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CompleteSigType
</span><a href="GHC.Tc.Gen.Bind.html#AcceptAny"><span class="hs-identifier hs-var">AcceptAny</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681098594"><span class="hs-identifier hs-var">cl</span></a></span><span class="annot"><span class="annottext">ConLike -&gt; [ConLike] -&gt; [ConLike]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[ConLike]
</span><a href="#local-6989586621681098596"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-275"></span><span>          </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CompleteSigType
</span><a href="GHC.Tc.Gen.Bind.html#AcceptAny"><span class="hs-identifier hs-var">AcceptAny</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681098587"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098587"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(CompleteSigType, [ConLike])
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe ConLike -&gt; TyCon -&gt; CompleteSigType
</span><a href="GHC.Tc.Gen.Bind.html#Fixed"><span class="hs-identifier hs-var">Fixed</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConLike -&gt; Maybe ConLike
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681098594"><span class="hs-identifier hs-var">cl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098587"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681098594"><span class="hs-identifier hs-var">cl</span></a></span><span class="annot"><span class="annottext">ConLike -&gt; [ConLike] -&gt; [ConLike]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[ConLike]
</span><a href="#local-6989586621681098596"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-276"></span><span>          </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#Fixed"><span class="hs-identifier hs-type">Fixed</span></a></span><span> </span><span id="local-6989586621681098586"><span class="annot"><span class="annottext">Maybe ConLike
</span><a href="#local-6989586621681098586"><span class="hs-identifier hs-var">mfcl</span></a></span></span><span> </span><span id="local-6989586621681098585"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098585"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe TyCon
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(CompleteSigType, [ConLike])
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe ConLike -&gt; TyCon -&gt; CompleteSigType
</span><a href="GHC.Tc.Gen.Bind.html#Fixed"><span class="hs-identifier hs-var">Fixed</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe ConLike
</span><a href="#local-6989586621681098586"><span class="hs-identifier hs-var">mfcl</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098585"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681098594"><span class="hs-identifier hs-var">cl</span></a></span><span class="annot"><span class="annottext">ConLike -&gt; [ConLike] -&gt; [ConLike]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[ConLike]
</span><a href="#local-6989586621681098596"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-277"></span><span>          </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#Fixed"><span class="hs-identifier hs-type">Fixed</span></a></span><span> </span><span id="local-6989586621681098584"><span class="annot"><span class="annottext">Maybe ConLike
</span><a href="#local-6989586621681098584"><span class="hs-identifier hs-var">mfcl</span></a></span></span><span> </span><span id="local-6989586621681098583"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098583"><span class="hs-identifier hs-var">tc</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681098582"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098582"><span class="hs-identifier hs-var">tc'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-278"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098583"><span class="hs-identifier hs-var">tc</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; TyCon -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098582"><span class="hs-identifier hs-var">tc'</span></a></span><span>
</span><span id="line-279"></span><span>              </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">(CompleteSigType, [ConLike])
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe ConLike -&gt; TyCon -&gt; CompleteSigType
</span><a href="GHC.Tc.Gen.Bind.html#Fixed"><span class="hs-identifier hs-var">Fixed</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe ConLike
</span><a href="#local-6989586621681098584"><span class="hs-identifier hs-var">mfcl</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098583"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681098594"><span class="hs-identifier hs-var">cl</span></a></span><span class="annot"><span class="annottext">ConLike -&gt; [ConLike] -&gt; [ConLike]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span class="annot"><span class="annottext">[ConLike]
</span><a href="#local-6989586621681098596"><span class="hs-identifier hs-var">cs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-280"></span><span>              </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe ConLike
</span><a href="#local-6989586621681098584"><span class="hs-identifier hs-var">mfcl</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-281"></span><span>                     </span><span class="annot"><span class="annottext">Maybe ConLike
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-282"></span><span>                      </span><span class="annot"><span class="annottext">SDoc
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
forall a. SDoc -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#addErrCtxt"><span class="hs-identifier hs-var">addErrCtxt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;In&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681098594"><span class="hs-identifier hs-var">cl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike]))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-283"></span><span>                        </span><span class="annot"><span class="annottext">SDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
forall a. SDoc -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#failWithTc"><span class="hs-identifier hs-var">failWithTc</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681098581"><span class="hs-identifier hs-var">typeSigErrMsg</span></a></span><span>
</span><span id="line-284"></span><span>                     </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681098580"><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681098580"><span class="hs-identifier hs-var">cl</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; IOEnv (Env TcGblEnv TcLclEnv) (CompleteSigType, [ConLike])
forall a. SDoc -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#failWithTc"><span class="hs-identifier hs-var">failWithTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConLike -&gt; SDoc
</span><a href="#local-6989586621681098579"><span class="hs-identifier hs-var">errMsg</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681098580"><span class="hs-identifier hs-var">cl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-285"></span><span>             </span><span class="hs-keyword">where</span><span>
</span><span id="line-286"></span><span>              </span><span class="annot"><a href="#local-6989586621681098581"><span class="hs-identifier hs-type">typeSigErrMsg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-287"></span><span>              </span><span id="local-6989586621681098581"><span class="annot"><span class="annottext">typeSigErrMsg :: SDoc
</span><a href="#local-6989586621681098581"><span class="hs-identifier hs-var hs-var">typeSigErrMsg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-288"></span><span>                </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Couldn't match expected type&quot;</span></span><span>
</span><span id="line-289"></span><span>                      </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098583"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-290"></span><span>                      </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;with&quot;</span></span><span>
</span><span id="line-291"></span><span>                      </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098582"><span class="hs-identifier hs-var">tc'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-292"></span><span>
</span><span id="line-293"></span><span>              </span><span class="annot"><a href="#local-6989586621681098579"><span class="hs-identifier hs-type">errMsg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Core.ConLike.html#ConLike"><span class="hs-identifier hs-type">ConLike</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-294"></span><span>              </span><span id="local-6989586621681098579"><span class="annot"><span class="annottext">errMsg :: ConLike -&gt; SDoc
</span><a href="#local-6989586621681098579"><span class="hs-identifier hs-var hs-var">errMsg</span></a></span></span><span> </span><span id="local-6989586621681098577"><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681098577"><span class="hs-identifier hs-var">fcl</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-295"></span><span>                </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Cannot form a group of complete patterns from patterns&quot;</span></span><span>
</span><span id="line-296"></span><span>                  </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConLike -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681098577"><span class="hs-identifier hs-var">fcl</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;and&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ConLike -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ConLike
</span><a href="#local-6989586621681098594"><span class="hs-identifier hs-var">cl</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-297"></span><span>                  </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;as they match different type constructors&quot;</span></span><span>
</span><span id="line-298"></span><span>                  </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098583"><span class="hs-identifier hs-var">tc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-299"></span><span>                               </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;resp.&quot;</span></span><span>
</span><span id="line-300"></span><span>                               </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681098582"><span class="hs-identifier hs-var">tc'</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-301"></span><span>  </span><span class="hs-comment">-- For some reason I haven't investigated further, the signatures come in</span><span>
</span><span id="line-302"></span><span>  </span><span class="hs-comment">-- backwards wrt. declaration order. So we reverse them here, because it makes</span><span>
</span><span id="line-303"></span><span>  </span><span class="hs-comment">-- a difference for incomplete match suggestions.</span><span>
</span><span id="line-304"></span><span>  </span><span class="hs-keyword">in</span><span>  </span><span class="annot"><span class="annottext">(LSig (GhcPass 'Renamed) -&gt; TcM (Maybe CompleteMatch))
-&gt; [LSig (GhcPass 'Renamed)]
-&gt; TcRnIf TcGblEnv TcLclEnv [CompleteMatch]
forall (m :: * -&gt; *) a b.
Applicative m =&gt;
(a -&gt; m (Maybe b)) -&gt; [a] -&gt; m [b]
</span><a href="GHC.Utils.Monad.html#mapMaybeM"><span class="hs-identifier hs-var">mapMaybeM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Sig (GhcPass 'Renamed) -&gt; TcM (Maybe CompleteMatch))
-&gt; LSig (GhcPass 'Renamed) -&gt; TcM (Maybe CompleteMatch)
forall a b. (a -&gt; TcM b) -&gt; Located a -&gt; TcM b
</span><a href="GHC.Tc.Utils.Monad.html#addLocM"><span class="hs-identifier hs-var">addLocM</span></a></span><span> </span><span class="annot"><span class="annottext">Sig (GhcPass 'Renamed) -&gt; TcM (Maybe CompleteMatch)
</span><a href="#local-6989586621681098631"><span class="hs-identifier hs-var">doOne</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)] -&gt; [LSig (GhcPass 'Renamed)]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098632"><span class="hs-identifier hs-var">sigs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- process in declaration order</span><span>
</span><span id="line-305"></span><span>
</span><span id="line-306"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcHsBootSigs"><span class="hs-identifier hs-type">tcHsBootSigs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Binds.html#LSig"><span class="hs-identifier hs-type">LSig</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-307"></span><span class="hs-comment">-- A hs-boot file has only one BindGroup, and it only has type</span><span>
</span><span id="line-308"></span><span class="hs-comment">-- signatures in it.  The renamer checked all this</span><span>
</span><span id="line-309"></span><span id="tcHsBootSigs"><span class="annot"><span class="annottext">tcHsBootSigs :: [(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; [LSig (GhcPass 'Renamed)] -&gt; TcM [TcId]
</span><a href="GHC.Tc.Gen.Bind.html#tcHsBootSigs"><span class="hs-identifier hs-var hs-var">tcHsBootSigs</span></a></span></span><span> </span><span id="local-6989586621681098573"><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098573"><span class="hs-identifier hs-var">binds</span></a></span></span><span> </span><span id="local-6989586621681098572"><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098572"><span class="hs-identifier hs-var">sigs</span></a></span></span><span>
</span><span id="line-310"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#checkTc"><span class="hs-identifier hs-var">checkTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098573"><span class="hs-identifier hs-var">binds</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Tc.Gen.Bind.html#badBootDeclErr"><span class="hs-identifier hs-var">badBootDeclErr</span></a></span><span>
</span><span id="line-311"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LSig (GhcPass 'Renamed) -&gt; TcM [TcId])
-&gt; [LSig (GhcPass 'Renamed)] -&gt; TcM [TcId]
forall (m :: * -&gt; *) a b. Monad m =&gt; (a -&gt; m [b]) -&gt; [a] -&gt; m [b]
</span><a href="GHC.Utils.Monad.html#concatMapM"><span class="hs-identifier hs-var">concatMapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Sig (GhcPass 'Renamed) -&gt; TcM [TcId])
-&gt; LSig (GhcPass 'Renamed) -&gt; TcM [TcId]
forall a b. (a -&gt; TcM b) -&gt; Located a -&gt; TcM b
</span><a href="GHC.Tc.Utils.Monad.html#addLocM"><span class="hs-identifier hs-var">addLocM</span></a></span><span> </span><span class="annot"><span class="annottext">Sig (GhcPass 'Renamed) -&gt; TcM [TcId]
</span><a href="#local-6989586621681098568"><span class="hs-identifier hs-var">tc_boot_sig</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LSig (GhcPass 'Renamed) -&gt; Bool)
-&gt; [LSig (GhcPass 'Renamed)] -&gt; [LSig (GhcPass 'Renamed)]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="annot"><span class="annottext">LSig (GhcPass 'Renamed) -&gt; Bool
forall name. LSig name -&gt; Bool
</span><a href="GHC.Hs.Binds.html#isTypeLSig"><span class="hs-identifier hs-var">isTypeLSig</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098572"><span class="hs-identifier hs-var">sigs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-312"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-313"></span><span>    </span><span id="local-6989586621681098568"><span class="annot"><span class="annottext">tc_boot_sig :: Sig (GhcPass 'Renamed) -&gt; TcM [TcId]
</span><a href="#local-6989586621681098568"><span class="hs-identifier hs-var hs-var">tc_boot_sig</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#TypeSig"><span class="hs-identifier hs-type">TypeSig</span></a></span><span> </span><span class="annot"><span class="annottext">XTypeSig (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681098553"><span class="annot"><span class="annottext">[Located (IdP (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098553"><span class="hs-identifier hs-var">lnames</span></a></span></span><span> </span><span id="local-6989586621681098552"><span class="annot"><span class="annottext">LHsSigWcType (GhcPass 'Renamed)
</span><a href="#local-6989586621681098552"><span class="hs-identifier hs-var">hs_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Located Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId)
-&gt; [Located Name] -&gt; TcM [TcId]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">Located Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="#local-6989586621681098550"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">[Located Name]
[Located (IdP (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098553"><span class="hs-identifier hs-var">lnames</span></a></span><span>
</span><span id="line-314"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-315"></span><span>        </span><span id="local-6989586621681098550"><span class="annot"><span class="annottext">f :: Located Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="#local-6989586621681098550"><span class="hs-identifier hs-var hs-var">f</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681098548"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098548"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-316"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681098547"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098547"><span class="hs-identifier hs-var">sigma_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UserTypeCtxt -&gt; LHsSigWcType (GhcPass 'Renamed) -&gt; TcM Kind
</span><a href="GHC.Tc.Gen.HsType.html#tcHsSigWcType"><span class="hs-identifier hs-var">tcHsSigWcType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Bool -&gt; UserTypeCtxt
</span><a href="GHC.Tc.Types.Origin.html#FunSigCtxt"><span class="hs-identifier hs-var">FunSigCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098548"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LHsSigWcType (GhcPass 'Renamed)
</span><a href="#local-6989586621681098552"><span class="hs-identifier hs-var">hs_ty</span></a></span><span>
</span><span id="line-317"></span><span>               </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcId -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Kind -&gt; TcId
</span><a href="GHC.Types.Id.html#mkVanillaGlobal"><span class="hs-identifier hs-var">mkVanillaGlobal</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098548"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098547"><span class="hs-identifier hs-var">sigma_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-318"></span><span>        </span><span class="hs-comment">-- Notice that we make GlobalIds, not LocalIds</span><span>
</span><span id="line-319"></span><span>    </span><span class="annot"><a href="#local-6989586621681098568"><span class="hs-identifier hs-var">tc_boot_sig</span></a></span><span> </span><span id="local-6989586621681098543"><span class="annot"><span class="annottext">Sig (GhcPass 'Renamed)
</span><a href="#local-6989586621681098543"><span class="hs-identifier hs-var">s</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcM [TcId]
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcHsBootSigs/tc_boot_sig&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Sig (GhcPass 'Renamed) -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Sig (GhcPass 'Renamed)
</span><a href="#local-6989586621681098543"><span class="hs-identifier hs-var">s</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-320"></span><span>
</span><span id="line-321"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#badBootDeclErr"><span class="hs-identifier hs-type">badBootDeclErr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#MsgDoc"><span class="hs-identifier hs-type">MsgDoc</span></a></span><span>
</span><span id="line-322"></span><span id="badBootDeclErr"><span class="annot"><span class="annottext">badBootDeclErr :: SDoc
</span><a href="GHC.Tc.Gen.Bind.html#badBootDeclErr"><span class="hs-identifier hs-var hs-var">badBootDeclErr</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Illegal declarations in an hs-boot file&quot;</span></span><span>
</span><span id="line-323"></span><span>
</span><span id="line-324"></span><span class="hs-comment">------------------------</span><span>
</span><span id="line-325"></span><span id="local-6989586621681099278"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcLocalBinds"><span class="hs-identifier hs-type">tcLocalBinds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#HsLocalBinds"><span class="hs-identifier hs-type">HsLocalBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099278"><span class="hs-identifier hs-type">thing</span></a></span><span>
</span><span id="line-326"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#HsLocalBinds"><span class="hs-identifier hs-type">HsLocalBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681099278"><span class="hs-identifier hs-type">thing</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-327"></span><span>
</span><span id="line-328"></span><span id="tcLocalBinds"><span class="annot"><span class="annottext">tcLocalBinds :: forall thing.
HsLocalBinds (GhcPass 'Renamed)
-&gt; TcM thing -&gt; TcM (HsLocalBinds (GhcPass 'Typechecked), thing)
</span><a href="GHC.Tc.Gen.Bind.html#tcLocalBinds"><span class="hs-identifier hs-var hs-var">tcLocalBinds</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#EmptyLocalBinds"><span class="hs-identifier hs-type">EmptyLocalBinds</span></a></span><span> </span><span id="local-6989586621681098529"><span class="annot"><span class="annottext">XEmptyLocalBinds (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681098529"><span class="hs-identifier hs-var">x</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681098528"><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098528"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-329"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681098527"><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098527"><span class="hs-identifier hs-var">thing</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098528"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-330"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(HsLocalBinds (GhcPass 'Typechecked), thing)
-&gt; TcM (HsLocalBinds (GhcPass 'Typechecked), thing)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XEmptyLocalBinds (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; HsLocalBinds (GhcPass 'Typechecked)
forall idL idR. XEmptyLocalBinds idL idR -&gt; HsLocalBindsLR idL idR
</span><a href="GHC.Hs.Binds.html#EmptyLocalBinds"><span class="hs-identifier hs-var">EmptyLocalBinds</span></a></span><span> </span><span class="annot"><span class="annottext">XEmptyLocalBinds (GhcPass 'Renamed) (GhcPass 'Renamed)
XEmptyLocalBinds (GhcPass 'Typechecked) (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098529"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098527"><span class="hs-identifier hs-var">thing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-331"></span><span>
</span><span id="line-332"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcLocalBinds"><span class="hs-identifier hs-var">tcLocalBinds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#HsValBinds"><span class="hs-identifier hs-type">HsValBinds</span></a></span><span> </span><span id="local-6989586621681098525"><span class="annot"><span class="annottext">XHsValBinds (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681098525"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#XValBindsLR"><span class="hs-identifier hs-type">XValBindsLR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#NValBinds"><span class="hs-identifier hs-type">NValBinds</span></a></span><span> </span><span id="local-6989586621681098522"><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098522"><span class="hs-identifier hs-var">binds</span></a></span></span><span> </span><span id="local-6989586621681098521"><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098521"><span class="hs-identifier hs-var">sigs</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span id="local-6989586621681098520"><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098520"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-333"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098519"><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098519"><span class="hs-identifier hs-var">binds'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098518"><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098518"><span class="hs-identifier hs-var">thing</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
-&gt; [(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; [LSig (GhcPass 'Renamed)]
-&gt; TcM thing
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
forall thing.
TopLevelFlag
-&gt; [(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; [LSig (GhcPass 'Renamed)]
-&gt; TcM thing
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
</span><a href="GHC.Tc.Gen.Bind.html#tcValBinds"><span class="hs-identifier hs-var">tcValBinds</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="GHC.Types.Basic.html#NotTopLevel"><span class="hs-identifier hs-var">NotTopLevel</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098522"><span class="hs-identifier hs-var">binds</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098521"><span class="hs-identifier hs-var">sigs</span></a></span><span> </span><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098520"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-334"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(HsLocalBinds (GhcPass 'Typechecked), thing)
-&gt; TcM (HsLocalBinds (GhcPass 'Typechecked), thing)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XHsValBinds (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; HsValBindsLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; HsLocalBinds (GhcPass 'Typechecked)
forall idL idR.
XHsValBinds idL idR
-&gt; HsValBindsLR idL idR -&gt; HsLocalBindsLR idL idR
</span><a href="GHC.Hs.Binds.html#HsValBinds"><span class="hs-identifier hs-var">HsValBinds</span></a></span><span> </span><span class="annot"><span class="annottext">XHsValBinds (GhcPass 'Renamed) (GhcPass 'Renamed)
XHsValBinds (GhcPass 'Typechecked) (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098525"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XXValBindsLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; HsValBindsLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
forall idL idR. XXValBindsLR idL idR -&gt; HsValBindsLR idL idR
</span><a href="GHC.Hs.Binds.html#XValBindsLR"><span class="hs-identifier hs-var">XValBindsLR</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
-&gt; [LSig (GhcPass 'Renamed)]
-&gt; NHsValBindsLR (GhcPass 'Typechecked)
forall idL.
[(RecFlag, LHsBinds idL)]
-&gt; [LSig (GhcPass 'Renamed)] -&gt; NHsValBindsLR idL
</span><a href="GHC.Hs.Binds.html#NValBinds"><span class="hs-identifier hs-var">NValBinds</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098519"><span class="hs-identifier hs-var">binds'</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098521"><span class="hs-identifier hs-var">sigs</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098518"><span class="hs-identifier hs-var">thing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-335"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcLocalBinds"><span class="hs-identifier hs-var">tcLocalBinds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#HsValBinds"><span class="hs-identifier hs-type">HsValBinds</span></a></span><span> </span><span class="annot"><span class="annottext">XHsValBinds (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#ValBinds"><span class="hs-identifier hs-type">ValBinds</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcM thing
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; TcM (HsLocalBinds (GhcPass 'Typechecked), thing)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcLocalBinds&quot;</span></span><span>
</span><span id="line-336"></span><span>
</span><span id="line-337"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcLocalBinds"><span class="hs-identifier hs-var">tcLocalBinds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#HsIPBinds"><span class="hs-identifier hs-type">HsIPBinds</span></a></span><span> </span><span id="local-6989586621681098513"><span class="annot"><span class="annottext">XHsIPBinds (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681098513"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#IPBinds"><span class="hs-identifier hs-type">IPBinds</span></a></span><span> </span><span class="annot"><span class="annottext">XIPBinds (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681098511"><span class="annot"><span class="annottext">[LIPBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098511"><span class="hs-identifier hs-var">ip_binds</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span id="local-6989586621681098510"><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098510"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-338"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681098509"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681098509"><span class="hs-identifier hs-var">ipClass</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM Class
</span><a href="GHC.Tc.Utils.Env.html#tcLookupClass"><span class="hs-identifier hs-var">tcLookupClass</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#ipClassName"><span class="hs-identifier hs-var">ipClassName</span></a></span><span>
</span><span id="line-339"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098507"><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098507"><span class="hs-identifier hs-var">given_ips</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098506"><span class="annot"><span class="annottext">[Located (IPBind (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098506"><span class="hs-identifier hs-var">ip_binds'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span>
</span><span id="line-340"></span><span>            </span><span class="annot"><span class="annottext">(LIPBind (GhcPass 'Renamed)
 -&gt; IOEnv
      (Env TcGblEnv TcLclEnv)
      (TcId, Located (IPBind (GhcPass 'Typechecked))))
-&gt; [LIPBind (GhcPass 'Renamed)]
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     ([TcId], [Located (IPBind (GhcPass 'Typechecked))])
forall (m :: * -&gt; *) a b c.
Applicative m =&gt;
(a -&gt; m (b, c)) -&gt; [a] -&gt; m ([b], [c])
</span><a href="../../base/src/Control.Monad.html#mapAndUnzipM"><span class="hs-identifier hs-var">mapAndUnzipM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(IPBind (GhcPass 'Renamed)
 -&gt; TcM (TcId, IPBind (GhcPass 'Typechecked)))
-&gt; LIPBind (GhcPass 'Renamed)
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (TcId, Located (IPBind (GhcPass 'Typechecked)))
forall a b c. (a -&gt; TcM (b, c)) -&gt; Located a -&gt; TcM (b, Located c)
</span><a href="GHC.Tc.Utils.Monad.html#wrapLocSndM"><span class="hs-identifier hs-var">wrapLocSndM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Class
-&gt; IPBind (GhcPass 'Renamed)
-&gt; TcM (TcId, IPBind (GhcPass 'Typechecked))
</span><a href="#local-6989586621681098503"><span class="hs-identifier hs-var">tc_ip_bind</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681098509"><span class="hs-identifier hs-var">ipClass</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LIPBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098511"><span class="hs-identifier hs-var">ip_binds</span></a></span><span>
</span><span id="line-341"></span><span>
</span><span id="line-342"></span><span>        </span><span class="hs-comment">-- If the binding binds ?x = E, we  must now</span><span>
</span><span id="line-343"></span><span>        </span><span class="hs-comment">-- discharge any ?x constraints in expr_lie</span><span>
</span><span id="line-344"></span><span>        </span><span class="hs-comment">-- See Note [Implicit parameter untouchables]</span><span>
</span><span id="line-345"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098502"><span class="annot"><span class="annottext">TcEvBinds
</span><a href="#local-6989586621681098502"><span class="hs-identifier hs-var">ev_binds</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098501"><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098501"><span class="hs-identifier hs-var">result</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SkolemInfo
-&gt; [TcId] -&gt; [TcId] -&gt; TcM thing -&gt; TcM (TcEvBinds, thing)
forall result.
SkolemInfo
-&gt; [TcId] -&gt; [TcId] -&gt; TcM result -&gt; TcM (TcEvBinds, result)
</span><a href="GHC.Tc.Utils.Unify.html#checkConstraints"><span class="hs-identifier hs-var">checkConstraints</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[HsIPName] -&gt; SkolemInfo
</span><a href="GHC.Tc.Types.Origin.html#IPSkol"><span class="hs-identifier hs-var">IPSkol</span></a></span><span> </span><span class="annot"><span class="annottext">[HsIPName]
</span><a href="#local-6989586621681098498"><span class="hs-identifier hs-var">ips</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-346"></span><span>                                  </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098507"><span class="hs-identifier hs-var">given_ips</span></a></span><span> </span><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098510"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-347"></span><span>
</span><span id="line-348"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(HsLocalBinds (GhcPass 'Typechecked), thing)
-&gt; TcM (HsLocalBinds (GhcPass 'Typechecked), thing)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XHsIPBinds (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; HsIPBinds (GhcPass 'Typechecked)
-&gt; HsLocalBinds (GhcPass 'Typechecked)
forall idL idR.
XHsIPBinds idL idR -&gt; HsIPBinds idR -&gt; HsLocalBindsLR idL idR
</span><a href="GHC.Hs.Binds.html#HsIPBinds"><span class="hs-identifier hs-var">HsIPBinds</span></a></span><span> </span><span class="annot"><span class="annottext">XHsIPBinds (GhcPass 'Renamed) (GhcPass 'Renamed)
XHsIPBinds (GhcPass 'Typechecked) (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098513"><span class="hs-identifier hs-var">x</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XIPBinds (GhcPass 'Typechecked)
-&gt; [Located (IPBind (GhcPass 'Typechecked))]
-&gt; HsIPBinds (GhcPass 'Typechecked)
forall id. XIPBinds id -&gt; [LIPBind id] -&gt; HsIPBinds id
</span><a href="GHC.Hs.Binds.html#IPBinds"><span class="hs-identifier hs-var">IPBinds</span></a></span><span> </span><span class="annot"><span class="annottext">XIPBinds (GhcPass 'Typechecked)
TcEvBinds
</span><a href="#local-6989586621681098502"><span class="hs-identifier hs-var">ev_binds</span></a></span><span> </span><span class="annot"><span class="annottext">[Located (IPBind (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098506"><span class="hs-identifier hs-var">ip_binds'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098501"><span class="hs-identifier hs-var">result</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-349"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-350"></span><span>    </span><span id="local-6989586621681098498"><span class="annot"><span class="annottext">ips :: [HsIPName]
</span><a href="#local-6989586621681098498"><span class="hs-identifier hs-var hs-var">ips</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">HsIPName
</span><a href="#local-6989586621681098497"><span class="hs-identifier hs-var">ip</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#IPBind"><span class="hs-identifier hs-type">IPBind</span></a></span><span> </span><span class="annot"><span class="annottext">XCIPBind (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681098497"><span class="annot"><span class="annottext">HsIPName
</span><a href="#local-6989586621681098497"><span class="hs-identifier hs-var">ip</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LIPBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098511"><span class="hs-identifier hs-var">ip_binds</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-351"></span><span>
</span><span id="line-352"></span><span>        </span><span class="hs-comment">-- I wonder if we should do these one at a time</span><span>
</span><span id="line-353"></span><span>        </span><span class="hs-comment">-- Consider     ?x = 4</span><span>
</span><span id="line-354"></span><span>        </span><span class="hs-comment">--              ?y = ?x + 1</span><span>
</span><span id="line-355"></span><span>    </span><span id="local-6989586621681098503"><span class="annot"><span class="annottext">tc_ip_bind :: Class
-&gt; IPBind (GhcPass 'Renamed)
-&gt; TcM (TcId, IPBind (GhcPass 'Typechecked))
</span><a href="#local-6989586621681098503"><span class="hs-identifier hs-var hs-var">tc_ip_bind</span></a></span></span><span> </span><span id="local-6989586621681098489"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681098489"><span class="hs-identifier hs-var">ipClass</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#IPBind"><span class="hs-identifier hs-type">IPBind</span></a></span><span> </span><span class="annot"><span class="annottext">XCIPBind (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681098488"><span class="annot"><span class="annottext">HsIPName
</span><a href="#local-6989586621681098488"><span class="hs-identifier hs-var">ip</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span id="local-6989586621681098487"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Renamed)
</span><a href="#local-6989586621681098487"><span class="hs-identifier hs-var">expr</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-356"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681098486"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098486"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM Kind
</span><a href="GHC.Tc.Utils.TcMType.html#newOpenFlexiTyVarTy"><span class="hs-identifier hs-var">newOpenFlexiTyVarTy</span></a></span><span>
</span><span id="line-357"></span><span>            </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098484"><span class="annot"><span class="annottext">p :: Kind
</span><a href="#local-6989586621681098484"><span class="hs-identifier hs-var hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Kind
</span><a href="GHC.Core.Type.html#mkStrLitTy"><span class="hs-identifier hs-var">mkStrLitTy</span></a></span><span> </span><span class="annot"><span class="annottext">(FastString -&gt; Kind) -&gt; FastString -&gt; Kind
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">HsIPName -&gt; FastString
</span><a href="GHC.Hs.Type.html#hsIPNameFS"><span class="hs-identifier hs-var">hsIPNameFS</span></a></span><span> </span><span class="annot"><span class="annottext">HsIPName
</span><a href="#local-6989586621681098488"><span class="hs-identifier hs-var">ip</span></a></span><span>
</span><span id="line-358"></span><span>            </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098482"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098482"><span class="hs-identifier hs-var">ip_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Class -&gt; TcThetaType -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="GHC.Tc.Utils.TcMType.html#newDict"><span class="hs-identifier hs-var">newDict</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681098489"><span class="hs-identifier hs-var">ipClass</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098484"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098486"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-359"></span><span>            </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098480"><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098480"><span class="hs-identifier hs-var">expr'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Renamed)
-&gt; Kind -&gt; TcM (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Gen.Expr.html#tcCheckMonoExpr"><span class="hs-identifier hs-var">tcCheckMonoExpr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Renamed)
</span><a href="#local-6989586621681098487"><span class="hs-identifier hs-var">expr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098486"><span class="hs-identifier hs-var">ty</span></a></span><span>
</span><span id="line-360"></span><span>            </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098479"><span class="annot"><span class="annottext">d :: LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098479"><span class="hs-identifier hs-var hs-var">d</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Class
-&gt; Kind
-&gt; Kind
-&gt; HsExpr (GhcPass 'Typechecked)
-&gt; HsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098478"><span class="hs-identifier hs-var">toDict</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681098489"><span class="hs-identifier hs-var">ipClass</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098484"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098486"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="annot"><span class="annottext">(HsExpr (GhcPass 'Typechecked) -&gt; HsExpr (GhcPass 'Typechecked))
-&gt; LHsExpr (GhcPass 'Typechecked) -&gt; LHsExpr (GhcPass 'Typechecked)
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-operator hs-var">`fmap`</span></a></span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098480"><span class="hs-identifier hs-var">expr'</span></a></span><span>
</span><span id="line-361"></span><span>            </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TcId, IPBind (GhcPass 'Typechecked))
-&gt; TcM (TcId, IPBind (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098482"><span class="hs-identifier hs-var">ip_id</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">XCIPBind (GhcPass 'Typechecked)
-&gt; Either (Located HsIPName) (IdP (GhcPass 'Typechecked))
-&gt; LHsExpr (GhcPass 'Typechecked)
-&gt; IPBind (GhcPass 'Typechecked)
forall id.
XCIPBind id
-&gt; Either (Located HsIPName) (IdP id) -&gt; LHsExpr id -&gt; IPBind id
</span><a href="GHC.Hs.Binds.html#IPBind"><span class="hs-identifier hs-var">IPBind</span></a></span><span> </span><span class="annot"><span class="annottext">NoExtField
XCIPBind (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Either (Located HsIPName) TcId
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098482"><span class="hs-identifier hs-var">ip_id</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098479"><span class="hs-identifier hs-var">d</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-362"></span><span>    </span><span class="annot"><a href="#local-6989586621681098503"><span class="hs-identifier hs-var">tc_ip_bind</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#IPBind"><span class="hs-identifier hs-type">IPBind</span></a></span><span> </span><span class="annot"><span class="annottext">XCIPBind (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LHsExpr (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; TcM (TcId, IPBind (GhcPass 'Typechecked))
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tc_ip_bind&quot;</span></span><span>
</span><span id="line-363"></span><span>
</span><span id="line-364"></span><span>    </span><span class="hs-comment">-- Coerces a `t` into a dictionary for `IP &quot;x&quot; t`.</span><span>
</span><span id="line-365"></span><span>    </span><span class="hs-comment">-- co : t -&gt; IP &quot;x&quot; t</span><span>
</span><span id="line-366"></span><span>    </span><span id="local-6989586621681098478"><span class="annot"><span class="annottext">toDict :: Class
-&gt; Kind
-&gt; Kind
-&gt; HsExpr (GhcPass 'Typechecked)
-&gt; HsExpr (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098478"><span class="hs-identifier hs-var hs-var">toDict</span></a></span></span><span> </span><span id="local-6989586621681098476"><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681098476"><span class="hs-identifier hs-var">ipClass</span></a></span></span><span> </span><span id="local-6989586621681098475"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098475"><span class="hs-identifier hs-var">x</span></a></span></span><span> </span><span id="local-6989586621681098474"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098474"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsWrapper
-&gt; HsExpr (GhcPass 'Typechecked) -&gt; HsExpr (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Utils.html#mkHsWrap"><span class="hs-identifier hs-var">mkHsWrap</span></a></span><span> </span><span class="annot"><span class="annottext">(HsWrapper
 -&gt; HsExpr (GhcPass 'Typechecked) -&gt; HsExpr (GhcPass 'Typechecked))
-&gt; HsWrapper
-&gt; HsExpr (GhcPass 'Typechecked)
-&gt; HsExpr (GhcPass 'Typechecked)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercionR -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#mkWpCastR"><span class="hs-identifier hs-var">mkWpCastR</span></a></span><span> </span><span class="annot"><span class="annottext">(TcCoercionR -&gt; HsWrapper) -&gt; TcCoercionR -&gt; HsWrapper
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-367"></span><span>                          </span><span class="annot"><span class="annottext">Kind -&gt; TcCoercionR
</span><a href="GHC.Tc.Types.Evidence.html#wrapIP"><span class="hs-identifier hs-var">wrapIP</span></a></span><span> </span><span class="annot"><span class="annottext">(Kind -&gt; TcCoercionR) -&gt; Kind -&gt; TcCoercionR
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Class -&gt; TcThetaType -&gt; Kind
</span><a href="GHC.Core.Predicate.html#mkClassPred"><span class="hs-identifier hs-var">mkClassPred</span></a></span><span> </span><span class="annot"><span class="annottext">Class
</span><a href="#local-6989586621681098476"><span class="hs-identifier hs-var">ipClass</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098475"><span class="hs-identifier hs-var">x</span></a></span><span class="hs-special">,</span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098474"><span class="hs-identifier hs-var">ty</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-368"></span><span>
</span><span id="line-369"></span><span class="hs-comment">{- Note [Implicit parameter untouchables]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We add the type variables in the types of the implicit parameters
as untouchables, not so much because we really must not unify them,
but rather because we otherwise end up with constraints like this
    Num alpha, Implic { wanted = alpha ~ Int }
The constraint solver solves alpha~Int by unification, but then
doesn't float that solved constraint out (it's not an unsolved
wanted).  Result disaster: the (Num alpha) is again solved, this
time by defaulting.  No no no.

However [Oct 10] this is all handled automatically by the
untouchable-range idea.
-}</span><span>
</span><span id="line-383"></span><span>
</span><span id="line-384"></span><span id="local-6989586621681099348"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcValBinds"><span class="hs-identifier hs-type">tcValBinds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span>
</span><span id="line-385"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Binds.html#LSig"><span class="hs-identifier hs-type">LSig</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-386"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099348"><span class="hs-identifier hs-type">thing</span></a></span><span>
</span><span id="line-387"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681099348"><span class="hs-identifier hs-type">thing</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-388"></span><span>
</span><span id="line-389"></span><span id="tcValBinds"><span class="annot"><span class="annottext">tcValBinds :: forall thing.
TopLevelFlag
-&gt; [(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; [LSig (GhcPass 'Renamed)]
-&gt; TcM thing
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
</span><a href="GHC.Tc.Gen.Bind.html#tcValBinds"><span class="hs-identifier hs-var hs-var">tcValBinds</span></a></span></span><span> </span><span id="local-6989586621681098460"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681098460"><span class="hs-identifier hs-var">top_lvl</span></a></span></span><span> </span><span id="local-6989586621681098459"><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098459"><span class="hs-identifier hs-var">binds</span></a></span></span><span> </span><span id="local-6989586621681098458"><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098458"><span class="hs-identifier hs-var">sigs</span></a></span></span><span> </span><span id="local-6989586621681098457"><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098457"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-390"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span>   </span><span class="hs-comment">-- Typecheck the signatures</span><span>
</span><span id="line-391"></span><span>            </span><span class="hs-comment">-- It's easier to do so now, once for all the SCCs together</span><span>
</span><span id="line-392"></span><span>            </span><span class="hs-comment">-- because a single signature  f,g :: &lt;type&gt;</span><span>
</span><span id="line-393"></span><span>            </span><span class="hs-comment">-- might relate to more than one SCC</span><span>
</span><span id="line-394"></span><span>          </span><span class="hs-special">(</span><span id="local-6989586621681098456"><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098456"><span class="hs-identifier hs-var">poly_ids</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098455"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098455"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[PatSynBind (GhcPass 'Renamed) (GhcPass 'Renamed)]
-&gt; TcM ([TcId], TcSigFun) -&gt; TcM ([TcId], TcSigFun)
forall a.
[PatSynBind (GhcPass 'Renamed) (GhcPass 'Renamed)]
-&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcAddPatSynPlaceholders"><span class="hs-identifier hs-var">tcAddPatSynPlaceholders</span></a></span><span> </span><span class="annot"><span class="annottext">[PatSynBind (GhcPass 'Renamed) (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098453"><span class="hs-identifier hs-var">patsyns</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM ([TcId], TcSigFun) -&gt; TcM ([TcId], TcSigFun))
-&gt; TcM ([TcId], TcSigFun) -&gt; TcM ([TcId], TcSigFun)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-395"></span><span>                                </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)] -&gt; TcM ([TcId], TcSigFun)
</span><a href="GHC.Tc.Gen.Sig.html#tcTySigs"><span class="hs-identifier hs-var">tcTySigs</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098458"><span class="hs-identifier hs-var">sigs</span></a></span><span>
</span><span id="line-396"></span><span>
</span><span id="line-397"></span><span>        </span><span class="hs-comment">-- Extend the envt right away with all the Ids</span><span>
</span><span id="line-398"></span><span>        </span><span class="hs-comment">--   declared with complete type signatures</span><span>
</span><span id="line-399"></span><span>        </span><span class="hs-comment">-- Do not extend the TcBinderStack; instead</span><span>
</span><span id="line-400"></span><span>        </span><span class="hs-comment">--   we extend it on a per-rhs basis in tcExtendForRhs</span><span>
</span><span id="line-401"></span><span>        </span><span class="hs-comment">--   See Note [Relevant bindings and the binder stack]</span><span>
</span><span id="line-402"></span><span>        </span><span class="hs-comment">--</span><span>
</span><span id="line-403"></span><span>        </span><span class="hs-comment">-- For the moment, let bindings and top-level bindings introduce</span><span>
</span><span id="line-404"></span><span>        </span><span class="hs-comment">-- only unrestricted variables.</span><span>
</span><span id="line-405"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
-&gt; [TcId]
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
forall a. TopLevelFlag -&gt; [TcId] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendSigIds"><span class="hs-identifier hs-var">tcExtendSigIds</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681098460"><span class="hs-identifier hs-var">top_lvl</span></a></span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098456"><span class="hs-identifier hs-var">poly_ids</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
 -&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing))
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-406"></span><span>     </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098450"><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098450"><span class="hs-identifier hs-var">binds'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098449"><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098449"><span class="hs-identifier hs-var">extra_binds'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098448"><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098448"><span class="hs-identifier hs-var">thing</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-407"></span><span>              </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
-&gt; TcSigFun
-&gt; TcPragEnv
-&gt; [(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
-&gt; TcM
     ([(RecFlag, LHsBinds (GhcPass 'Typechecked))],
      ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing))
forall thing.
TopLevelFlag
-&gt; TcSigFun
-&gt; TcPragEnv
-&gt; [(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; TcM thing
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
</span><a href="GHC.Tc.Gen.Bind.html#tcBindGroups"><span class="hs-identifier hs-var">tcBindGroups</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681098460"><span class="hs-identifier hs-var">top_lvl</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098455"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098446"><span class="hs-identifier hs-var">prag_fn</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098459"><span class="hs-identifier hs-var">binds</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
 -&gt; TcM
      ([(RecFlag, LHsBinds (GhcPass 'Typechecked))],
       ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)))
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
-&gt; TcM
     ([(RecFlag, LHsBinds (GhcPass 'Typechecked))],
      ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-408"></span><span>                 </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681098445"><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098445"><span class="hs-identifier hs-var">thing</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098457"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-409"></span><span>                       </span><span class="hs-comment">-- See Note [Pattern synonym builders don't yield dependencies]</span><span>
</span><span id="line-410"></span><span>                       </span><span class="hs-comment">--     in GHC.Rename.Bind</span><span>
</span><span id="line-411"></span><span>                    </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098444"><span class="annot"><span class="annottext">[LHsBinds (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681098444"><span class="hs-identifier hs-var">patsyn_builders</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(PatSynBind (GhcPass 'Renamed) (GhcPass 'Renamed)
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (LHsBinds (GhcPass 'Typechecked)))
-&gt; [PatSynBind (GhcPass 'Renamed) (GhcPass 'Renamed)]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [LHsBinds (GhcPass 'Typechecked)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">PatSynBind (GhcPass 'Renamed) (GhcPass 'Renamed)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (LHsBinds (GhcPass 'Typechecked))
</span><a href="GHC.Tc.TyCl.PatSyn.html#tcPatSynBuilderBind"><span class="hs-identifier hs-var">tcPatSynBuilderBind</span></a></span><span> </span><span class="annot"><span class="annottext">[PatSynBind (GhcPass 'Renamed) (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098453"><span class="hs-identifier hs-var">patsyns</span></a></span><span>
</span><span id="line-412"></span><span>                    </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098443"><span class="annot"><span class="annottext">extra_binds :: [(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098443"><span class="hs-identifier hs-var hs-var">extra_binds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RecFlag
</span><a href="GHC.Types.Basic.html#NonRecursive"><span class="hs-identifier hs-var">NonRecursive</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098441"><span class="hs-identifier hs-var">builder</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-413"></span><span>                                        </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681098441"><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098441"><span class="hs-identifier hs-var">builder</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LHsBinds (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681098444"><span class="hs-identifier hs-var">patsyn_builders</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-414"></span><span>                    </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098443"><span class="hs-identifier hs-var">extra_binds</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098445"><span class="hs-identifier hs-var">thing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-415"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098450"><span class="hs-identifier hs-var">binds'</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
-&gt; [(RecFlag, LHsBinds (GhcPass 'Typechecked))]
-&gt; [(RecFlag, LHsBinds (GhcPass 'Typechecked))]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098449"><span class="hs-identifier hs-var">extra_binds'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098448"><span class="hs-identifier hs-var">thing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span class="hs-special">}</span><span>
</span><span id="line-416"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-417"></span><span>    </span><span id="local-6989586621681098453"><span class="annot"><span class="annottext">patsyns :: [PatSynBind (GhcPass 'Renamed) (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098453"><span class="hs-identifier hs-var hs-var">patsyns</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; [PatSynBind (GhcPass 'Renamed) (GhcPass 'Renamed)]
forall id. [(RecFlag, LHsBinds id)] -&gt; [PatSynBind id id]
</span><a href="GHC.Hs.Utils.html#getPatSynBinds"><span class="hs-identifier hs-var">getPatSynBinds</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098459"><span class="hs-identifier hs-var">binds</span></a></span><span>
</span><span id="line-418"></span><span>    </span><span id="local-6989586621681098446"><span class="annot"><span class="annottext">prag_fn :: TcPragEnv
</span><a href="#local-6989586621681098446"><span class="hs-identifier hs-var hs-var">prag_fn</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
-&gt; LHsBinds (GhcPass 'Renamed) -&gt; TcPragEnv
</span><a href="GHC.Tc.Gen.Sig.html#mkPragEnv"><span class="hs-identifier hs-var">mkPragEnv</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098458"><span class="hs-identifier hs-var">sigs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">((RecFlag, LHsBinds (GhcPass 'Renamed))
 -&gt; LHsBinds (GhcPass 'Renamed) -&gt; LHsBinds (GhcPass 'Renamed))
-&gt; LHsBinds (GhcPass 'Renamed)
-&gt; [(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; LHsBinds (GhcPass 'Renamed)
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed)
-&gt; LHsBinds (GhcPass 'Renamed) -&gt; LHsBinds (GhcPass 'Renamed)
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-identifier hs-var">unionBags</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Renamed)
 -&gt; LHsBinds (GhcPass 'Renamed) -&gt; LHsBinds (GhcPass 'Renamed))
-&gt; ((RecFlag, LHsBinds (GhcPass 'Renamed))
    -&gt; LHsBinds (GhcPass 'Renamed))
-&gt; (RecFlag, LHsBinds (GhcPass 'Renamed))
-&gt; LHsBinds (GhcPass 'Renamed)
-&gt; LHsBinds (GhcPass 'Renamed)
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(RecFlag, LHsBinds (GhcPass 'Renamed))
-&gt; LHsBinds (GhcPass 'Renamed)
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed)
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098459"><span class="hs-identifier hs-var">binds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-419"></span><span>
</span><span id="line-420"></span><span class="hs-comment">------------------------</span><span>
</span><span id="line-421"></span><span id="local-6989586621681099231"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcBindGroups"><span class="hs-identifier hs-type">tcBindGroups</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier hs-type">TcSigFun</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html#TcPragEnv"><span class="hs-identifier hs-type">TcPragEnv</span></a></span><span>
</span><span id="line-422"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099231"><span class="hs-identifier hs-type">thing</span></a></span><span>
</span><span id="line-423"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681099231"><span class="hs-identifier hs-type">thing</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-424"></span><span class="hs-comment">-- Typecheck a whole lot of value bindings,</span><span>
</span><span id="line-425"></span><span class="hs-comment">-- one strongly-connected component at a time</span><span>
</span><span id="line-426"></span><span class="hs-comment">-- Here a &quot;strongly connected component&quot; has the straightforward</span><span>
</span><span id="line-427"></span><span class="hs-comment">-- meaning of a group of bindings that mention each other,</span><span>
</span><span id="line-428"></span><span class="hs-comment">-- ignoring type signatures (that part comes later)</span><span>
</span><span id="line-429"></span><span>
</span><span id="line-430"></span><span id="tcBindGroups"><span class="annot"><span class="annottext">tcBindGroups :: forall thing.
TopLevelFlag
-&gt; TcSigFun
-&gt; TcPragEnv
-&gt; [(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; TcM thing
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
</span><a href="GHC.Tc.Gen.Bind.html#tcBindGroups"><span class="hs-identifier hs-var hs-var">tcBindGroups</span></a></span></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span id="local-6989586621681098429"><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098429"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-431"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681098428"><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098428"><span class="hs-identifier hs-var">thing</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098429"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-432"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098428"><span class="hs-identifier hs-var">thing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-433"></span><span>
</span><span id="line-434"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcBindGroups"><span class="hs-identifier hs-var">tcBindGroups</span></a></span><span> </span><span id="local-6989586621681098427"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681098427"><span class="hs-identifier hs-var">top_lvl</span></a></span></span><span> </span><span id="local-6989586621681098426"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098426"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span> </span><span id="local-6989586621681098425"><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098425"><span class="hs-identifier hs-var">prag_fn</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098424"><span class="annot"><span class="annottext">(RecFlag, LHsBinds (GhcPass 'Renamed))
</span><a href="#local-6989586621681098424"><span class="hs-identifier hs-var">group</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span id="local-6989586621681098423"><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098423"><span class="hs-identifier hs-var">groups</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681098422"><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098422"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-435"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-comment">-- See Note [Closed binder groups]</span><span>
</span><span id="line-436"></span><span>          </span><span id="local-6989586621681098421"><span class="annot"><span class="annottext">TcTypeEnv
</span><a href="#local-6989586621681098421"><span class="hs-identifier hs-var">type_env</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM TcTypeEnv
</span><a href="GHC.Tc.Utils.Monad.html#getLclTypeEnv"><span class="hs-identifier hs-var">getLclTypeEnv</span></a></span><span>
</span><span id="line-437"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098419"><span class="annot"><span class="annottext">closed :: IsGroupClosed
</span><a href="#local-6989586621681098419"><span class="hs-identifier hs-var hs-var">closed</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTypeEnv -&gt; LHsBinds (GhcPass 'Renamed) -&gt; IsGroupClosed
</span><a href="GHC.Tc.Gen.Bind.html#isClosedBndrGroup"><span class="hs-identifier hs-var">isClosedBndrGroup</span></a></span><span> </span><span class="annot"><span class="annottext">TcTypeEnv
</span><a href="#local-6989586621681098421"><span class="hs-identifier hs-var">type_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(RecFlag, LHsBinds (GhcPass 'Renamed))
-&gt; LHsBinds (GhcPass 'Renamed)
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">(RecFlag, LHsBinds (GhcPass 'Renamed))
</span><a href="#local-6989586621681098424"><span class="hs-identifier hs-var">group</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-438"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098417"><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098417"><span class="hs-identifier hs-var">group'</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098416"><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098416"><span class="hs-identifier hs-var">groups'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098415"><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098415"><span class="hs-identifier hs-var">thing</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-439"></span><span>                </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
-&gt; TcSigFun
-&gt; TcPragEnv
-&gt; (RecFlag, LHsBinds (GhcPass 'Renamed))
-&gt; IsGroupClosed
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
-&gt; TcM
     ([(RecFlag, LHsBinds (GhcPass 'Typechecked))],
      ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing))
forall thing.
TopLevelFlag
-&gt; TcSigFun
-&gt; TcPragEnv
-&gt; (RecFlag, LHsBinds (GhcPass 'Renamed))
-&gt; IsGroupClosed
-&gt; TcM thing
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
</span><a href="GHC.Tc.Gen.Bind.html#tc_group"><span class="hs-identifier hs-var">tc_group</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681098427"><span class="hs-identifier hs-var">top_lvl</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098426"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098425"><span class="hs-identifier hs-var">prag_fn</span></a></span><span> </span><span class="annot"><span class="annottext">(RecFlag, LHsBinds (GhcPass 'Renamed))
</span><a href="#local-6989586621681098424"><span class="hs-identifier hs-var">group</span></a></span><span> </span><span class="annot"><span class="annottext">IsGroupClosed
</span><a href="#local-6989586621681098419"><span class="hs-identifier hs-var">closed</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
 -&gt; TcM
      ([(RecFlag, LHsBinds (GhcPass 'Typechecked))],
       ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)))
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
-&gt; TcM
     ([(RecFlag, LHsBinds (GhcPass 'Typechecked))],
      ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-440"></span><span>                   </span><span class="annot"><span class="annottext">TopLevelFlag
-&gt; TcSigFun
-&gt; TcPragEnv
-&gt; [(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; TcM thing
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
forall thing.
TopLevelFlag
-&gt; TcSigFun
-&gt; TcPragEnv
-&gt; [(RecFlag, LHsBinds (GhcPass 'Renamed))]
-&gt; TcM thing
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
</span><a href="GHC.Tc.Gen.Bind.html#tcBindGroups"><span class="hs-identifier hs-var">tcBindGroups</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681098427"><span class="hs-identifier hs-var">top_lvl</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098426"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098425"><span class="hs-identifier hs-var">prag_fn</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098423"><span class="hs-identifier hs-var">groups</span></a></span><span> </span><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098422"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-441"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098417"><span class="hs-identifier hs-var">group'</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
-&gt; [(RecFlag, LHsBinds (GhcPass 'Typechecked))]
-&gt; [(RecFlag, LHsBinds (GhcPass 'Typechecked))]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[(RecFlag, LHsBinds (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681098416"><span class="hs-identifier hs-var">groups'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098415"><span class="hs-identifier hs-var">thing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-442"></span><span>
</span><span id="line-443"></span><span class="hs-comment">-- Note [Closed binder groups]</span><span>
</span><span id="line-444"></span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-445"></span><span class="hs-comment">--</span><span>
</span><span id="line-446"></span><span class="hs-comment">--  A mutually recursive group is &quot;closed&quot; if all of the free variables of</span><span>
</span><span id="line-447"></span><span class="hs-comment">--  the bindings are closed. For example</span><span>
</span><span id="line-448"></span><span class="hs-comment">--</span><span>
</span><span id="line-449"></span><span class="hs-comment">-- &gt;  h = \x -&gt; let f = ...g...</span><span>
</span><span id="line-450"></span><span class="hs-comment">-- &gt;                g = ....f...x...</span><span>
</span><span id="line-451"></span><span class="hs-comment">-- &gt;             in ...</span><span>
</span><span id="line-452"></span><span class="hs-comment">--</span><span>
</span><span id="line-453"></span><span class="hs-comment">-- Here @g@ is not closed because it mentions @x@; and hence neither is @f@</span><span>
</span><span id="line-454"></span><span class="hs-comment">-- closed.</span><span>
</span><span id="line-455"></span><span class="hs-comment">--</span><span>
</span><span id="line-456"></span><span class="hs-comment">-- So we need to compute closed-ness on each strongly connected components,</span><span>
</span><span id="line-457"></span><span class="hs-comment">-- before we sub-divide it based on what type signatures it has.</span><span>
</span><span id="line-458"></span><span class="hs-comment">--</span><span>
</span><span id="line-459"></span><span>
</span><span id="line-460"></span><span class="hs-comment">------------------------</span><span>
</span><span id="line-461"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tc_group"><span class="hs-identifier hs-type">tc_group</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621681099219"><span class="annot"><a href="#local-6989586621681099219"><span class="hs-identifier hs-type">thing</span></a></span></span><span class="hs-operator">.</span><span>
</span><span id="line-462"></span><span>            </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier hs-type">TcSigFun</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html#TcPragEnv"><span class="hs-identifier hs-type">TcPragEnv</span></a></span><span>
</span><span id="line-463"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IsGroupClosed"><span class="hs-identifier hs-type">IsGroupClosed</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099219"><span class="hs-identifier hs-type">thing</span></a></span><span>
</span><span id="line-464"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681099219"><span class="hs-identifier hs-type">thing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-465"></span><span>
</span><span id="line-466"></span><span class="hs-comment">-- Typecheck one strongly-connected component of the original program.</span><span>
</span><span id="line-467"></span><span class="hs-comment">-- We get a list of groups back, because there may</span><span>
</span><span id="line-468"></span><span class="hs-comment">-- be specialisations etc as well</span><span>
</span><span id="line-469"></span><span>
</span><span id="line-470"></span><span id="tc_group"><span class="annot"><span class="annottext">tc_group :: forall thing.
TopLevelFlag
-&gt; TcSigFun
-&gt; TcPragEnv
-&gt; (RecFlag, LHsBinds (GhcPass 'Renamed))
-&gt; IsGroupClosed
-&gt; TcM thing
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
</span><a href="GHC.Tc.Gen.Bind.html#tc_group"><span class="hs-identifier hs-var hs-var">tc_group</span></a></span></span><span> </span><span id="local-6989586621681098394"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681098394"><span class="hs-identifier hs-var">top_lvl</span></a></span></span><span> </span><span id="local-6989586621681098393"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098393"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span> </span><span id="local-6989586621681098392"><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098392"><span class="hs-identifier hs-var">prag_fn</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RecFlag
</span><a href="GHC.Types.Basic.html#NonRecursive"><span class="hs-identifier hs-var">NonRecursive</span></a></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098391"><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed)
</span><a href="#local-6989586621681098391"><span class="hs-identifier hs-var">binds</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681098390"><span class="annot"><span class="annottext">IsGroupClosed
</span><a href="#local-6989586621681098390"><span class="hs-identifier hs-var">closed</span></a></span></span><span> </span><span id="local-6989586621681098389"><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098389"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-471"></span><span>        </span><span class="hs-comment">-- A single non-recursive binding</span><span>
</span><span id="line-472"></span><span>        </span><span class="hs-comment">-- We want to keep non-recursive things non-recursive</span><span>
</span><span id="line-473"></span><span>        </span><span class="hs-comment">-- so that we desugar unlifted bindings correctly</span><span>
</span><span id="line-474"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098388"><span class="annot"><span class="annottext">bind :: LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098388"><span class="hs-identifier hs-var hs-var">bind</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed) -&gt; [LHsBind (GhcPass 'Renamed)]
forall a. Bag a -&gt; [a]
</span><a href="GHC.Data.Bag.html#bagToList"><span class="hs-identifier hs-var">bagToList</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed)
</span><a href="#local-6989586621681098391"><span class="hs-identifier hs-var">binds</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-475"></span><span>                 </span><span class="hs-special">[</span><span id="local-6989586621681098386"><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098386"><span class="hs-identifier hs-var">bind</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098386"><span class="hs-identifier hs-var">bind</span></a></span><span>
</span><span id="line-476"></span><span>                 </span><span class="hs-special">[</span><span class="hs-special">]</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; LHsBind (GhcPass 'Renamed)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tc_group: empty list of binds&quot;</span></span><span>
</span><span id="line-477"></span><span>                 </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><span class="hs-identifier">_</span></span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; LHsBind (GhcPass 'Renamed)
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tc_group: NonRecursive binds is not a singleton bag&quot;</span></span><span>
</span><span id="line-478"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098385"><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098385"><span class="hs-identifier hs-var">bind'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098384"><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098384"><span class="hs-identifier hs-var">thing</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
-&gt; TcSigFun
-&gt; TcPragEnv
-&gt; LHsBind (GhcPass 'Renamed)
-&gt; IsGroupClosed
-&gt; TcM thing
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), thing)
forall thing.
TopLevelFlag
-&gt; TcSigFun
-&gt; TcPragEnv
-&gt; LHsBind (GhcPass 'Renamed)
-&gt; IsGroupClosed
-&gt; TcM thing
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), thing)
</span><a href="GHC.Tc.Gen.Bind.html#tc_single"><span class="hs-identifier hs-var">tc_single</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681098394"><span class="hs-identifier hs-var">top_lvl</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098393"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098392"><span class="hs-identifier hs-var">prag_fn</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098388"><span class="hs-identifier hs-var">bind</span></a></span><span> </span><span class="annot"><span class="annottext">IsGroupClosed
</span><a href="#local-6989586621681098390"><span class="hs-identifier hs-var">closed</span></a></span><span>
</span><span id="line-479"></span><span>                                     </span><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098389"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-480"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">RecFlag
</span><a href="GHC.Types.Basic.html#NonRecursive"><span class="hs-identifier hs-var">NonRecursive</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098385"><span class="hs-identifier hs-var">bind'</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098384"><span class="hs-identifier hs-var">thing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-481"></span><span>
</span><span id="line-482"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tc_group"><span class="hs-identifier hs-var">tc_group</span></a></span><span> </span><span id="local-6989586621681098382"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681098382"><span class="hs-identifier hs-var">top_lvl</span></a></span></span><span> </span><span id="local-6989586621681098381"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098381"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span> </span><span id="local-6989586621681098380"><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098380"><span class="hs-identifier hs-var">prag_fn</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">RecFlag
</span><a href="GHC.Types.Basic.html#Recursive"><span class="hs-identifier hs-var">Recursive</span></a></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098378"><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed)
</span><a href="#local-6989586621681098378"><span class="hs-identifier hs-var">binds</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681098377"><span class="annot"><span class="annottext">IsGroupClosed
</span><a href="#local-6989586621681098377"><span class="hs-identifier hs-var">closed</span></a></span></span><span> </span><span id="local-6989586621681098376"><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098376"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-483"></span><span>  </span><span class="hs-glyph">=</span><span>     </span><span class="hs-comment">-- To maximise polymorphism, we do a new</span><span>
</span><span id="line-484"></span><span>        </span><span class="hs-comment">-- strongly-connected-component analysis, this time omitting</span><span>
</span><span id="line-485"></span><span>        </span><span class="hs-comment">-- any references to variables with type signatures.</span><span>
</span><span id="line-486"></span><span>        </span><span class="hs-comment">-- (This used to be optional, but isn't now.)</span><span>
</span><span id="line-487"></span><span>        </span><span class="hs-comment">-- See Note [Polymorphic recursion] in &quot;GHC.Hs.Binds&quot;.</span><span>
</span><span id="line-488"></span><span>    </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tc_group rec&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed) -&gt; SDoc
forall (idL :: Pass) (idR :: Pass).
(OutputableBndrId idL, OutputableBndrId idR) =&gt;
LHsBindsLR (GhcPass idL) (GhcPass idR) -&gt; SDoc
</span><a href="GHC.Hs.Binds.html#pprLHsBinds"><span class="hs-identifier hs-var">pprLHsBinds</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed)
</span><a href="#local-6989586621681098378"><span class="hs-identifier hs-var">binds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-489"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Maybe (LHsBind (GhcPass 'Renamed))
-&gt; (LHsBind (GhcPass 'Renamed) -&gt; TcRn ()) -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; Maybe a -&gt; (a -&gt; m ()) -&gt; m ()
</span><a href="GHC.Data.Maybe.html#whenIsJust"><span class="hs-identifier hs-var">whenIsJust</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (LHsBind (GhcPass 'Renamed))
</span><a href="#local-6989586621681098373"><span class="hs-identifier hs-var">mbFirstPatSyn</span></a></span><span> </span><span class="annot"><span class="annottext">((LHsBind (GhcPass 'Renamed) -&gt; TcRn ()) -&gt; TcRn ())
-&gt; (LHsBind (GhcPass 'Renamed) -&gt; TcRn ()) -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681098372"><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098372"><span class="hs-identifier hs-var">lpat_syn</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-490"></span><span>            </span><span class="annot"><span class="annottext">SrcSpan -&gt; LHsBinds (GhcPass 'Renamed) -&gt; TcRn ()
forall (p :: Pass) a.
(OutputableBndrId p, CollectPass (GhcPass p)) =&gt;
SrcSpan -&gt; LHsBinds (GhcPass p) -&gt; TcM a
</span><a href="GHC.Tc.Gen.Bind.html#recursivePatSynErr"><span class="hs-identifier hs-var">recursivePatSynErr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed) -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098372"><span class="hs-identifier hs-var">lpat_syn</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed)
</span><a href="#local-6989586621681098378"><span class="hs-identifier hs-var">binds</span></a></span><span>
</span><span id="line-491"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098369"><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098369"><span class="hs-identifier hs-var">binds1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098368"><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098368"><span class="hs-identifier hs-var">thing</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[SCC (LHsBind (GhcPass 'Renamed))]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), thing)
</span><a href="#local-6989586621681098367"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[SCC (LHsBind (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098366"><span class="hs-identifier hs-var">sccs</span></a></span><span>
</span><span id="line-492"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
-&gt; TcM ([(RecFlag, LHsBinds (GhcPass 'Typechecked))], thing)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">RecFlag
</span><a href="GHC.Types.Basic.html#Recursive"><span class="hs-identifier hs-var">Recursive</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098369"><span class="hs-identifier hs-var">binds1</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098368"><span class="hs-identifier hs-var">thing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-493"></span><span>                </span><span class="hs-comment">-- Rec them all together</span><span>
</span><span id="line-494"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-495"></span><span>    </span><span id="local-6989586621681098373"><span class="annot"><span class="annottext">mbFirstPatSyn :: Maybe (LHsBind (GhcPass 'Renamed))
</span><a href="#local-6989586621681098373"><span class="hs-identifier hs-var hs-var">mbFirstPatSyn</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LHsBind (GhcPass 'Renamed) -&gt; Bool)
-&gt; LHsBinds (GhcPass 'Renamed)
-&gt; Maybe (LHsBind (GhcPass 'Renamed))
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Maybe a
</span><a href="../../base/src/Data.Foldable.html#find"><span class="hs-identifier hs-var">find</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed) -&gt; Bool
forall {idL} {idR}. HsBindLR idL idR -&gt; Bool
</span><a href="#local-6989586621681098365"><span class="hs-identifier hs-var">isPatSyn</span></a></span><span> </span><span class="annot"><span class="annottext">(HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed) -&gt; Bool)
-&gt; (LHsBind (GhcPass 'Renamed)
    -&gt; HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed))
-&gt; LHsBind (GhcPass 'Renamed)
-&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
-&gt; HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed)
</span><a href="#local-6989586621681098378"><span class="hs-identifier hs-var">binds</span></a></span><span>
</span><span id="line-496"></span><span>    </span><span id="local-6989586621681098365"><span class="annot"><span class="annottext">isPatSyn :: HsBindLR idL idR -&gt; Bool
</span><a href="#local-6989586621681098365"><span class="hs-identifier hs-var hs-var">isPatSyn</span></a></span></span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#PatSynBind"><span class="hs-identifier hs-type">PatSynBind</span></a></span><span class="hs-special">{</span><span class="hs-special">}</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-497"></span><span>    </span><span class="annot"><a href="#local-6989586621681098365"><span class="hs-identifier hs-var">isPatSyn</span></a></span><span> </span><span class="annot"><span class="annottext">HsBindLR idL idR
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-498"></span><span>
</span><span id="line-499"></span><span>    </span><span class="annot"><a href="#local-6989586621681098366"><span class="hs-identifier hs-type">sccs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../containers/src/Data.Graph.html#SCC"><span class="hs-identifier hs-type">SCC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBind"><span class="hs-identifier hs-type">LHsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-500"></span><span>    </span><span id="local-6989586621681098366"><span class="annot"><span class="annottext">sccs :: [SCC (LHsBind (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098366"><span class="hs-identifier hs-var hs-var">sccs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Node BKey (LHsBind (GhcPass 'Renamed))]
-&gt; [SCC (LHsBind (GhcPass 'Renamed))]
forall key payload.
Uniquable key =&gt;
[Node key payload] -&gt; [SCC payload]
</span><a href="GHC.Data.Graph.Directed.html#stronglyConnCompFromEdgedVerticesUniq"><span class="hs-identifier hs-var">stronglyConnCompFromEdgedVerticesUniq</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcSigFun
-&gt; LHsBinds (GhcPass 'Renamed)
-&gt; [Node BKey (LHsBind (GhcPass 'Renamed))]
</span><a href="GHC.Tc.Gen.Bind.html#mkEdges"><span class="hs-identifier hs-var">mkEdges</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098381"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed)
</span><a href="#local-6989586621681098378"><span class="hs-identifier hs-var">binds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-501"></span><span>
</span><span id="line-502"></span><span>    </span><span class="annot"><a href="#local-6989586621681098367"><span class="hs-identifier hs-type">go</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../containers/src/Data.Graph.html#SCC"><span class="hs-identifier hs-type">SCC</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBind"><span class="hs-identifier hs-type">LHsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681099219"><span class="hs-identifier hs-type">thing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-503"></span><span>    </span><span id="local-6989586621681098367"><span class="annot"><span class="annottext">go :: [SCC (LHsBind (GhcPass 'Renamed))]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), thing)
</span><a href="#local-6989586621681098367"><span class="hs-identifier hs-var hs-var">go</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098361"><span class="annot"><span class="annottext">SCC (LHsBind (GhcPass 'Renamed))
</span><a href="#local-6989586621681098361"><span class="hs-identifier hs-var">scc</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621681098360"><span class="annot"><span class="annottext">[SCC (LHsBind (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098360"><span class="hs-identifier hs-var">sccs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098359"><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098359"><span class="hs-identifier hs-var">binds1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098358"><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098358"><span class="hs-identifier hs-var">ids1</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SCC (LHsBind (GhcPass 'Renamed))
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="#local-6989586621681098357"><span class="hs-identifier hs-var">tc_scc</span></a></span><span> </span><span class="annot"><span class="annottext">SCC (LHsBind (GhcPass 'Renamed))
</span><a href="#local-6989586621681098361"><span class="hs-identifier hs-var">scc</span></a></span><span>
</span><span id="line-504"></span><span>                         </span><span class="hs-comment">-- recursive bindings must be unrestricted</span><span>
</span><span id="line-505"></span><span>                         </span><span class="hs-comment">-- (the ids added to the environment here are the name of the recursive definitions).</span><span>
</span><span id="line-506"></span><span>                        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098356"><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098356"><span class="hs-identifier hs-var">binds2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098355"><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098355"><span class="hs-identifier hs-var">thing</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
-&gt; TcSigFun
-&gt; IsGroupClosed
-&gt; [TcId]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), thing)
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), thing)
forall a.
TopLevelFlag
-&gt; TcSigFun -&gt; IsGroupClosed -&gt; [TcId] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendLetEnv"><span class="hs-identifier hs-var">tcExtendLetEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681098382"><span class="hs-identifier hs-var">top_lvl</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098381"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">IsGroupClosed
</span><a href="#local-6989586621681098377"><span class="hs-identifier hs-var">closed</span></a></span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098358"><span class="hs-identifier hs-var">ids1</span></a></span><span>
</span><span id="line-507"></span><span>                                                            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SCC (LHsBind (GhcPass 'Renamed))]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), thing)
</span><a href="#local-6989586621681098367"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="annot"><span class="annottext">[SCC (LHsBind (GhcPass 'Renamed))]
</span><a href="#local-6989586621681098360"><span class="hs-identifier hs-var">sccs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-508"></span><span>                        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Typechecked), thing)
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), thing)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098359"><span class="hs-identifier hs-var">binds1</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
-&gt; LHsBinds (GhcPass 'Typechecked)
-&gt; LHsBinds (GhcPass 'Typechecked)
forall a. Bag a -&gt; Bag a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unionBags"><span class="hs-operator hs-var">`unionBags`</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098356"><span class="hs-identifier hs-var">binds2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098355"><span class="hs-identifier hs-var">thing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-509"></span><span>    </span><span class="annot"><a href="#local-6989586621681098367"><span class="hs-identifier hs-var">go</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>         </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681098353"><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098353"><span class="hs-identifier hs-var">thing</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098376"><span class="hs-identifier hs-var">thing_inside</span></a></span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Typechecked), thing)
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), thing)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098353"><span class="hs-identifier hs-var">thing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-510"></span><span>
</span><span id="line-511"></span><span>    </span><span id="local-6989586621681098357"><span class="annot"><span class="annottext">tc_scc :: SCC (LHsBind (GhcPass 'Renamed))
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="#local-6989586621681098357"><span class="hs-identifier hs-var hs-var">tc_scc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../containers/src/Data.Graph.html#AcyclicSCC"><span class="hs-identifier hs-type">AcyclicSCC</span></a></span><span> </span><span id="local-6989586621681098351"><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098351"><span class="hs-identifier hs-var">bind</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RecFlag
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="#local-6989586621681098350"><span class="hs-identifier hs-var">tc_sub_group</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="GHC.Types.Basic.html#NonRecursive"><span class="hs-identifier hs-var">NonRecursive</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098351"><span class="hs-identifier hs-var">bind</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-512"></span><span>    </span><span class="annot"><a href="#local-6989586621681098357"><span class="hs-identifier hs-var">tc_scc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../containers/src/Data.Graph.html#CyclicSCC"><span class="hs-identifier hs-type">CyclicSCC</span></a></span><span> </span><span id="local-6989586621681098348"><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098348"><span class="hs-identifier hs-var">binds</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">RecFlag
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="#local-6989586621681098350"><span class="hs-identifier hs-var">tc_sub_group</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="GHC.Types.Basic.html#Recursive"><span class="hs-identifier hs-var">Recursive</span></a></span><span>    </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098348"><span class="hs-identifier hs-var">binds</span></a></span><span>
</span><span id="line-513"></span><span>
</span><span id="line-514"></span><span>    </span><span id="local-6989586621681098350"><span class="annot"><span class="annottext">tc_sub_group :: RecFlag
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="#local-6989586621681098350"><span class="hs-identifier hs-var hs-var">tc_sub_group</span></a></span></span><span> </span><span id="local-6989586621681098347"><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681098347"><span class="hs-identifier hs-var">rec_tc</span></a></span></span><span> </span><span id="local-6989586621681098346"><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098346"><span class="hs-identifier hs-var">binds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-515"></span><span>      </span><span class="annot"><span class="annottext">TcSigFun
-&gt; TcPragEnv
-&gt; RecFlag
-&gt; RecFlag
-&gt; IsGroupClosed
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="GHC.Tc.Gen.Bind.html#tcPolyBinds"><span class="hs-identifier hs-var">tcPolyBinds</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098381"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098380"><span class="hs-identifier hs-var">prag_fn</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="GHC.Types.Basic.html#Recursive"><span class="hs-identifier hs-var">Recursive</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681098347"><span class="hs-identifier hs-var">rec_tc</span></a></span><span> </span><span class="annot"><span class="annottext">IsGroupClosed
</span><a href="#local-6989586621681098377"><span class="hs-identifier hs-var">closed</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098346"><span class="hs-identifier hs-var">binds</span></a></span><span>
</span><span id="line-516"></span><span>
</span><span id="line-517"></span><span id="local-6989586621681099208"><span id="local-6989586621681099209"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#recursivePatSynErr"><span class="hs-identifier hs-type">recursivePatSynErr</span></a></span><span> </span><span class="hs-glyph">::</span><span>
</span><span id="line-518"></span><span>     </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#OutputableBndrId"><span class="hs-identifier hs-type">OutputableBndrId</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099209"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Hs.Utils.html#CollectPass"><span class="hs-identifier hs-type">CollectPass</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPass"><span class="hs-identifier hs-type">GhcPass</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099209"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-519"></span><span>  </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-comment">-- ^ The location of the first pattern synonym binding</span><span>
</span><span id="line-520"></span><span>             </span><span class="hs-comment">--   (for error reporting)</span><span>
</span><span id="line-521"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPass"><span class="hs-identifier hs-type">GhcPass</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099209"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-522"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099208"><span class="hs-identifier hs-type">a</span></a></span></span></span><span>
</span><span id="line-523"></span><span id="recursivePatSynErr"><span class="annot"><span class="annottext">recursivePatSynErr :: forall (p :: Pass) a.
(OutputableBndrId p, CollectPass (GhcPass p)) =&gt;
SrcSpan -&gt; LHsBinds (GhcPass p) -&gt; TcM a
</span><a href="GHC.Tc.Gen.Bind.html#recursivePatSynErr"><span class="hs-identifier hs-var hs-var">recursivePatSynErr</span></a></span></span><span> </span><span id="local-6989586621681098333"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098333"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681098332"><span class="annot"><span class="annottext">LHsBinds (GhcPass p)
</span><a href="#local-6989586621681098332"><span class="hs-identifier hs-var">binds</span></a></span></span><span>
</span><span id="line-524"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; SDoc -&gt; TcRn a
forall a. SrcSpan -&gt; SDoc -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#failAt"><span class="hs-identifier hs-var">failAt</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098333"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; TcRn a) -&gt; SDoc -&gt; TcRn a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-525"></span><span>    </span><span class="annot"><span class="annottext">SDoc -&gt; BKey -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Recursive pattern synonym definition with following bindings:&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-526"></span><span>       </span><span class="annot"><span class="annottext">BKey
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="annot"><span class="annottext">([SDoc] -&gt; SDoc) -&gt; [SDoc] -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(GenLocated SrcSpan (HsBindLR (GhcPass p) (GhcPass p)) -&gt; SDoc)
-&gt; [GenLocated SrcSpan (HsBindLR (GhcPass p) (GhcPass p))]
-&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated SrcSpan (HsBindLR (GhcPass p) (GhcPass p)) -&gt; SDoc
forall {p} {a} {idR}.
(CollectPass p, Outputable (IdP p), Outputable a) =&gt;
GenLocated a (HsBindLR p idR) -&gt; SDoc
</span><a href="#local-6989586621681098328"><span class="hs-identifier hs-var">pprLBind</span></a></span><span> </span><span class="annot"><span class="annottext">([GenLocated SrcSpan (HsBindLR (GhcPass p) (GhcPass p))] -&gt; [SDoc])
-&gt; (LHsBinds (GhcPass p)
    -&gt; [GenLocated SrcSpan (HsBindLR (GhcPass p) (GhcPass p))])
-&gt; LHsBinds (GhcPass p)
-&gt; [SDoc]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass p)
-&gt; [GenLocated SrcSpan (HsBindLR (GhcPass p) (GhcPass p))]
forall a. Bag a -&gt; [a]
</span><a href="GHC.Data.Bag.html#bagToList"><span class="hs-identifier hs-var">bagToList</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass p) -&gt; [SDoc]) -&gt; LHsBinds (GhcPass p) -&gt; [SDoc]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass p)
</span><a href="#local-6989586621681098332"><span class="hs-identifier hs-var">binds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-527"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-528"></span><span>    </span><span id="local-6989586621681098325"><span class="annot"><span class="annottext">pprLoc :: a -&gt; SDoc
</span><a href="#local-6989586621681098325"><span class="hs-identifier hs-var hs-var">pprLoc</span></a></span></span><span> </span><span id="local-6989586621681098324"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681098324"><span class="hs-identifier hs-var">loc</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#parens"><span class="hs-identifier hs-var">parens</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;defined at&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681098324"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-529"></span><span>    </span><span id="local-6989586621681098328"><span class="annot"><span class="annottext">pprLBind :: GenLocated a (HsBindLR p idR) -&gt; SDoc
</span><a href="#local-6989586621681098328"><span class="hs-identifier hs-var hs-var">pprLBind</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681098314"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681098314"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681098313"><span class="annot"><span class="annottext">HsBindLR p idR
</span><a href="#local-6989586621681098313"><span class="hs-identifier hs-var">bind</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(IdP p -&gt; SDoc) -&gt; [IdP p] -&gt; SDoc
forall a. (a -&gt; SDoc) -&gt; [a] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#pprWithCommas"><span class="hs-identifier hs-var">pprWithCommas</span></a></span><span> </span><span class="annot"><span class="annottext">IdP p -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsBindLR p idR -&gt; [IdP p]
forall p idR. CollectPass p =&gt; HsBindLR p idR -&gt; [IdP p]
</span><a href="GHC.Hs.Utils.html#collectHsBindBinders"><span class="hs-identifier hs-var">collectHsBindBinders</span></a></span><span> </span><span class="annot"><span class="annottext">HsBindLR p idR
</span><a href="#local-6989586621681098313"><span class="hs-identifier hs-var">bind</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-530"></span><span>                                </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">a -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="#local-6989586621681098325"><span class="hs-identifier hs-var">pprLoc</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681098314"><span class="hs-identifier hs-var">loc</span></a></span><span>
</span><span id="line-531"></span><span>
</span><span id="line-532"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tc_single"><span class="hs-identifier hs-type">tc_single</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-keyword">forall</span><span> </span><span id="local-6989586621681099215"><span class="annot"><a href="#local-6989586621681099215"><span class="hs-identifier hs-type">thing</span></a></span></span><span class="hs-operator">.</span><span>
</span><span id="line-533"></span><span>            </span><span class="annot"><a href="GHC.Types.Basic.html#TopLevelFlag"><span class="hs-identifier hs-type">TopLevelFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier hs-type">TcSigFun</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html#TcPragEnv"><span class="hs-identifier hs-type">TcPragEnv</span></a></span><span>
</span><span id="line-534"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBind"><span class="hs-identifier hs-type">LHsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IsGroupClosed"><span class="hs-identifier hs-type">IsGroupClosed</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099215"><span class="hs-identifier hs-type">thing</span></a></span><span>
</span><span id="line-535"></span><span>          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="#local-6989586621681099215"><span class="hs-identifier hs-type">thing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-536"></span><span id="tc_single"><span class="annot"><span class="annottext">tc_single :: forall thing.
TopLevelFlag
-&gt; TcSigFun
-&gt; TcPragEnv
-&gt; LHsBind (GhcPass 'Renamed)
-&gt; IsGroupClosed
-&gt; TcM thing
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), thing)
</span><a href="GHC.Tc.Gen.Bind.html#tc_single"><span class="hs-identifier hs-var hs-var">tc_single</span></a></span></span><span> </span><span id="local-6989586621681098304"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681098304"><span class="hs-identifier hs-var">_top_lvl</span></a></span></span><span> </span><span id="local-6989586621681098303"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098303"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span> </span><span id="local-6989586621681098302"><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098302"><span class="hs-identifier hs-var">_prag_fn</span></a></span></span><span>
</span><span id="line-537"></span><span>          </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#PatSynBind"><span class="hs-identifier hs-type">PatSynBind</span></a></span><span> </span><span class="annot"><span class="annottext">XPatSynBind (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681098301"><span class="annot"><span class="annottext">psb :: PatSynBind (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681098301"><span class="hs-identifier hs-var">psb</span></a></span></span><span class="hs-glyph">@</span><span class="annot"><a href="GHC.Hs.Binds.html#PSB"><span class="hs-identifier hs-type">PSB</span></a></span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">psb_id :: forall idL idR. PatSynBind idL idR -&gt; Located (IdP idL)
</span><a href="GHC.Hs.Binds.html#psb_id"><span class="hs-identifier hs-var">psb_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681098298"><span class="annot"><span class="annottext">IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681098298"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-538"></span><span>          </span><span class="annot"><span class="annottext">IsGroupClosed
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681098297"><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098297"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-539"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098296"><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098296"><span class="hs-identifier hs-var">aux_binds</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098295"><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681098295"><span class="hs-identifier hs-var">tcg_env</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">PatSynBind (GhcPass 'Renamed) (GhcPass 'Renamed)
-&gt; Maybe TcSigInfo
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), TcGblEnv)
</span><a href="GHC.Tc.TyCl.PatSyn.html#tcPatSynDecl"><span class="hs-identifier hs-var">tcPatSynDecl</span></a></span><span> </span><span class="annot"><span class="annottext">PatSynBind (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681098301"><span class="hs-identifier hs-var">psb</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098303"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681098298"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-540"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098294"><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098294"><span class="hs-identifier hs-var">thing</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcGblEnv -&gt; TcM thing -&gt; TcM thing
forall gbl lcl a. gbl -&gt; TcRnIf gbl lcl a -&gt; TcRnIf gbl lcl a
</span><a href="GHC.Tc.Utils.Monad.html#setGblEnv"><span class="hs-identifier hs-var">setGblEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcGblEnv
</span><a href="#local-6989586621681098295"><span class="hs-identifier hs-var">tcg_env</span></a></span><span> </span><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098297"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-541"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Typechecked), thing)
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), thing)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098296"><span class="hs-identifier hs-var">aux_binds</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098294"><span class="hs-identifier hs-var">thing</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-542"></span><span>       </span><span class="hs-special">}</span><span>
</span><span id="line-543"></span><span>
</span><span id="line-544"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tc_single"><span class="hs-identifier hs-var">tc_single</span></a></span><span> </span><span id="local-6989586621681098292"><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681098292"><span class="hs-identifier hs-var">top_lvl</span></a></span></span><span> </span><span id="local-6989586621681098291"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098291"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span> </span><span id="local-6989586621681098290"><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098290"><span class="hs-identifier hs-var">prag_fn</span></a></span></span><span> </span><span id="local-6989586621681098289"><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098289"><span class="hs-identifier hs-var">lbind</span></a></span></span><span> </span><span id="local-6989586621681098288"><span class="annot"><span class="annottext">IsGroupClosed
</span><a href="#local-6989586621681098288"><span class="hs-identifier hs-var">closed</span></a></span></span><span> </span><span id="local-6989586621681098287"><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098287"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-545"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098286"><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098286"><span class="hs-identifier hs-var">binds1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098285"><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098285"><span class="hs-identifier hs-var">ids</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcSigFun
-&gt; TcPragEnv
-&gt; RecFlag
-&gt; RecFlag
-&gt; IsGroupClosed
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="GHC.Tc.Gen.Bind.html#tcPolyBinds"><span class="hs-identifier hs-var">tcPolyBinds</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098291"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098290"><span class="hs-identifier hs-var">prag_fn</span></a></span><span>
</span><span id="line-546"></span><span>                                      </span><span class="annot"><span class="annottext">RecFlag
</span><a href="GHC.Types.Basic.html#NonRecursive"><span class="hs-identifier hs-var">NonRecursive</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="GHC.Types.Basic.html#NonRecursive"><span class="hs-identifier hs-var">NonRecursive</span></a></span><span>
</span><span id="line-547"></span><span>                                      </span><span class="annot"><span class="annottext">IsGroupClosed
</span><a href="#local-6989586621681098288"><span class="hs-identifier hs-var">closed</span></a></span><span>
</span><span id="line-548"></span><span>                                      </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098289"><span class="hs-identifier hs-var">lbind</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-549"></span><span>         </span><span class="hs-comment">-- since we are defining a non-recursive binding, it is not necessary here</span><span>
</span><span id="line-550"></span><span>         </span><span class="hs-comment">-- to define an unrestricted binding. But we do so until toplevel linear bindings are supported.</span><span>
</span><span id="line-551"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098284"><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098284"><span class="hs-identifier hs-var">thing</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
-&gt; TcSigFun -&gt; IsGroupClosed -&gt; [TcId] -&gt; TcM thing -&gt; TcM thing
forall a.
TopLevelFlag
-&gt; TcSigFun -&gt; IsGroupClosed -&gt; [TcId] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendLetEnv"><span class="hs-identifier hs-var">tcExtendLetEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="#local-6989586621681098292"><span class="hs-identifier hs-var">top_lvl</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098291"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">IsGroupClosed
</span><a href="#local-6989586621681098288"><span class="hs-identifier hs-var">closed</span></a></span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098285"><span class="hs-identifier hs-var">ids</span></a></span><span> </span><span class="annot"><span class="annottext">TcM thing
</span><a href="#local-6989586621681098287"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-552"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Typechecked), thing)
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), thing)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098286"><span class="hs-identifier hs-var">binds1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">thing
</span><a href="#local-6989586621681098284"><span class="hs-identifier hs-var">thing</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-553"></span><span>
</span><span id="line-554"></span><span class="hs-comment">------------------------</span><span>
</span><span id="line-555"></span><span class="hs-keyword">type</span><span> </span><span id="BKey"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#BKey"><span class="hs-identifier hs-var">BKey</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-comment">-- Just number off the bindings</span><span>
</span><span id="line-556"></span><span>
</span><span id="line-557"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#mkEdges"><span class="hs-identifier hs-type">mkEdges</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier hs-type">TcSigFun</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Data.Graph.Directed.html#Node"><span class="hs-identifier hs-type">Node</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#BKey"><span class="hs-identifier hs-type">BKey</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBind"><span class="hs-identifier hs-type">LHsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-558"></span><span class="hs-comment">-- See Note [Polymorphic recursion] in &quot;GHC.Hs.Binds&quot;.</span><span>
</span><span id="line-559"></span><span id="mkEdges"><span class="annot"><span class="annottext">mkEdges :: TcSigFun
-&gt; LHsBinds (GhcPass 'Renamed)
-&gt; [Node BKey (LHsBind (GhcPass 'Renamed))]
</span><a href="GHC.Tc.Gen.Bind.html#mkEdges"><span class="hs-identifier hs-var hs-var">mkEdges</span></a></span></span><span> </span><span id="local-6989586621681098283"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098283"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span> </span><span id="local-6989586621681098282"><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed)
</span><a href="#local-6989586621681098282"><span class="hs-identifier hs-var">binds</span></a></span></span><span>
</span><span id="line-560"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
-&gt; BKey -&gt; [BKey] -&gt; Node BKey (LHsBind (GhcPass 'Renamed))
forall key payload. payload -&gt; key -&gt; [key] -&gt; Node key payload
</span><a href="GHC.Data.Graph.Directed.html#DigraphNode"><span class="hs-identifier hs-var">DigraphNode</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098280"><span class="hs-identifier hs-var">bind</span></a></span><span> </span><span class="annot"><span class="annottext">BKey
</span><a href="#local-6989586621681098279"><span class="hs-identifier hs-var">key</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">BKey
</span><a href="#local-6989586621681098278"><span class="hs-identifier hs-var">key</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681098277"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098277"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">UniqSet Name -&gt; [Name]
forall elt. UniqSet elt -&gt; [elt]
</span><a href="GHC.Types.Unique.Set.html#nonDetEltsUniqSet"><span class="hs-identifier hs-var">nonDetEltsUniqSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
-&gt; XFunBind (GhcPass 'Renamed) (GhcPass 'Renamed)
forall {idL} {idR}.
(XPatBind idL idR ~ XFunBind idL idR,
 XFunBind idL idR ~ UniqSet Name) =&gt;
HsBindLR idL idR -&gt; XFunBind idL idR
</span><a href="#local-6989586621681098275"><span class="hs-identifier hs-var">bind_fvs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
-&gt; HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098280"><span class="hs-identifier hs-var">bind</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-561"></span><span>                         </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681098278"><span class="annot"><span class="annottext">BKey
</span><a href="#local-6989586621681098278"><span class="hs-identifier hs-var">key</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">NameEnv BKey -&gt; Name -&gt; Maybe BKey
forall a. NameEnv a -&gt; Name -&gt; Maybe a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv"><span class="hs-identifier hs-var">lookupNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv BKey
</span><a href="#local-6989586621681098273"><span class="hs-identifier hs-var">key_map</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098277"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="#local-6989586621681098272"><span class="hs-identifier hs-var">no_sig</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098277"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-562"></span><span>    </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098280"><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098280"><span class="hs-identifier hs-var">bind</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098279"><span class="annot"><span class="annottext">BKey
</span><a href="#local-6989586621681098279"><span class="hs-identifier hs-var">key</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(LHsBind (GhcPass 'Renamed), BKey)]
</span><a href="#local-6989586621681098271"><span class="hs-identifier hs-var">keyd_binds</span></a></span><span>
</span><span id="line-563"></span><span>    </span><span class="hs-special">]</span><span>
</span><span id="line-564"></span><span>    </span><span class="hs-comment">-- It's OK to use nonDetEltsUFM here as stronglyConnCompFromEdgedVertices</span><span>
</span><span id="line-565"></span><span>    </span><span class="hs-comment">-- is still deterministic even if the edges are in nondeterministic order</span><span>
</span><span id="line-566"></span><span>    </span><span class="hs-comment">-- as explained in Note [Deterministic SCC] in GHC.Data.Graph.Directed.</span><span>
</span><span id="line-567"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-568"></span><span>    </span><span id="local-6989586621681098275"><span class="annot"><span class="annottext">bind_fvs :: HsBindLR idL idR -&gt; XFunBind idL idR
</span><a href="#local-6989586621681098275"><span class="hs-identifier hs-var hs-var">bind_fvs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#FunBind"><span class="hs-identifier hs-type">FunBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">fun_ext :: forall idL idR. HsBindLR idL idR -&gt; XFunBind idL idR
</span><a href="GHC.Hs.Binds.html#fun_ext"><span class="hs-identifier hs-var">fun_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681098261"><span class="annot"><span class="annottext">XFunBind idL idR
</span><a href="#local-6989586621681098261"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XFunBind idL idR
</span><a href="#local-6989586621681098261"><span class="hs-identifier hs-var">fvs</span></a></span><span>
</span><span id="line-569"></span><span>    </span><span class="annot"><a href="#local-6989586621681098275"><span class="hs-identifier hs-var">bind_fvs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#PatBind"><span class="hs-identifier hs-type">PatBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pat_ext :: forall idL idR. HsBindLR idL idR -&gt; XPatBind idL idR
</span><a href="GHC.Hs.Binds.html#pat_ext"><span class="hs-identifier hs-var">pat_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681098258"><span class="annot"><span class="annottext">XPatBind idL idR
</span><a href="#local-6989586621681098258"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XFunBind idL idR
XPatBind idL idR
</span><a href="#local-6989586621681098258"><span class="hs-identifier hs-var">fvs</span></a></span><span>
</span><span id="line-570"></span><span>    </span><span class="annot"><a href="#local-6989586621681098275"><span class="hs-identifier hs-var">bind_fvs</span></a></span><span> </span><span class="annot"><span class="annottext">HsBindLR idL idR
</span><span class="hs-identifier">_</span></span><span>                           </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet Name
XFunBind idL idR
</span><a href="GHC.Types.Name.Set.html#emptyNameSet"><span class="hs-identifier hs-var">emptyNameSet</span></a></span><span>
</span><span id="line-571"></span><span>
</span><span id="line-572"></span><span>    </span><span class="annot"><a href="#local-6989586621681098272"><span class="hs-identifier hs-type">no_sig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-573"></span><span>    </span><span id="local-6989586621681098272"><span class="annot"><span class="annottext">no_sig :: Name -&gt; Bool
</span><a href="#local-6989586621681098272"><span class="hs-identifier hs-var hs-var">no_sig</span></a></span></span><span> </span><span id="local-6989586621681098256"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098256"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcSigFun -&gt; Name -&gt; Bool
</span><a href="GHC.Tc.Types.html#hasCompleteSig"><span class="hs-identifier hs-var">hasCompleteSig</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098283"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098256"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-574"></span><span>
</span><span id="line-575"></span><span>    </span><span id="local-6989586621681098271"><span class="annot"><span class="annottext">keyd_binds :: [(LHsBind (GhcPass 'Renamed), BKey)]
</span><a href="#local-6989586621681098271"><span class="hs-identifier hs-var hs-var">keyd_binds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed) -&gt; [LHsBind (GhcPass 'Renamed)]
forall a. Bag a -&gt; [a]
</span><a href="GHC.Data.Bag.html#bagToList"><span class="hs-identifier hs-var">bagToList</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed)
</span><a href="#local-6989586621681098282"><span class="hs-identifier hs-var">binds</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
-&gt; [BKey] -&gt; [(LHsBind (GhcPass 'Renamed), BKey)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-operator hs-var">`zip`</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">BKey
</span><span class="hs-number">0</span></span><span class="hs-glyph">::</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#BKey"><span class="hs-identifier hs-type">BKey</span></a></span><span> </span><span class="hs-glyph">..</span><span class="hs-special">]</span><span>
</span><span id="line-576"></span><span>
</span><span id="line-577"></span><span>    </span><span class="annot"><a href="#local-6989586621681098273"><span class="hs-identifier hs-type">key_map</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#BKey"><span class="hs-identifier hs-type">BKey</span></a></span><span>     </span><span class="hs-comment">-- Which binding it comes from</span><span>
</span><span id="line-578"></span><span>    </span><span id="local-6989586621681098273"><span class="annot"><span class="annottext">key_map :: NameEnv BKey
</span><a href="#local-6989586621681098273"><span class="hs-identifier hs-var hs-var">key_map</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Name, BKey)] -&gt; NameEnv BKey
forall a. [(Name, a)] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#mkNameEnv"><span class="hs-identifier hs-var">mkNameEnv</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098252"><span class="hs-identifier hs-var">bndr</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">BKey
</span><a href="#local-6989586621681098251"><span class="hs-identifier hs-var">key</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681098250"><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681098250"><span class="hs-identifier hs-var">bind</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098251"><span class="annot"><span class="annottext">BKey
</span><a href="#local-6989586621681098251"><span class="hs-identifier hs-var">key</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(LHsBind (GhcPass 'Renamed), BKey)]
</span><a href="#local-6989586621681098271"><span class="hs-identifier hs-var">keyd_binds</span></a></span><span>
</span><span id="line-579"></span><span>                                     </span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098252"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098252"><span class="hs-identifier hs-var">bndr</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
-&gt; [IdP (GhcPass 'Renamed)]
forall p idR. CollectPass p =&gt; HsBindLR p idR -&gt; [IdP p]
</span><a href="GHC.Hs.Utils.html#collectHsBindBinders"><span class="hs-identifier hs-var">collectHsBindBinders</span></a></span><span> </span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681098250"><span class="hs-identifier hs-var">bind</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-580"></span><span>
</span><span id="line-581"></span><span class="hs-comment">------------------------</span><span>
</span><span id="line-582"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcPolyBinds"><span class="hs-identifier hs-type">tcPolyBinds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier hs-type">TcSigFun</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html#TcPragEnv"><span class="hs-identifier hs-type">TcPragEnv</span></a></span><span>
</span><span id="line-583"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span>         </span><span class="hs-comment">-- Whether the group is really recursive</span><span>
</span><span id="line-584"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span>         </span><span class="hs-comment">-- Whether it's recursive after breaking</span><span>
</span><span id="line-585"></span><span>                               </span><span class="hs-comment">-- dependencies based on type signatures</span><span>
</span><span id="line-586"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IsGroupClosed"><span class="hs-identifier hs-type">IsGroupClosed</span></a></span><span>   </span><span class="hs-comment">-- Whether the group is closed</span><span>
</span><span id="line-587"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBind"><span class="hs-identifier hs-type">LHsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span>  </span><span class="hs-comment">-- None are PatSynBind</span><span>
</span><span id="line-588"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-589"></span><span>
</span><span id="line-590"></span><span class="hs-comment">-- Typechecks a single bunch of values bindings all together,</span><span>
</span><span id="line-591"></span><span class="hs-comment">-- and generalises them.  The bunch may be only part of a recursive</span><span>
</span><span id="line-592"></span><span class="hs-comment">-- group, because we use type signatures to maximise polymorphism</span><span>
</span><span id="line-593"></span><span class="hs-comment">--</span><span>
</span><span id="line-594"></span><span class="hs-comment">-- Returns a list because the input may be a single non-recursive binding,</span><span>
</span><span id="line-595"></span><span class="hs-comment">-- in which case the dependency order of the resulting bindings is</span><span>
</span><span id="line-596"></span><span class="hs-comment">-- important.</span><span>
</span><span id="line-597"></span><span class="hs-comment">--</span><span>
</span><span id="line-598"></span><span class="hs-comment">-- Knows nothing about the scope of the bindings</span><span>
</span><span id="line-599"></span><span class="hs-comment">-- None of the bindings are pattern synonyms</span><span>
</span><span id="line-600"></span><span>
</span><span id="line-601"></span><span id="tcPolyBinds"><span class="annot"><span class="annottext">tcPolyBinds :: TcSigFun
-&gt; TcPragEnv
-&gt; RecFlag
-&gt; RecFlag
-&gt; IsGroupClosed
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="GHC.Tc.Gen.Bind.html#tcPolyBinds"><span class="hs-identifier hs-var hs-var">tcPolyBinds</span></a></span></span><span> </span><span id="local-6989586621681098249"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098249"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span> </span><span id="local-6989586621681098248"><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098248"><span class="hs-identifier hs-var">prag_fn</span></a></span></span><span> </span><span id="local-6989586621681098247"><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681098247"><span class="hs-identifier hs-var">rec_group</span></a></span></span><span> </span><span id="local-6989586621681098246"><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681098246"><span class="hs-identifier hs-var">rec_tc</span></a></span></span><span> </span><span id="local-6989586621681098245"><span class="annot"><span class="annottext">IsGroupClosed
</span><a href="#local-6989586621681098245"><span class="hs-identifier hs-var">closed</span></a></span></span><span> </span><span id="local-6989586621681098244"><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098244"><span class="hs-identifier hs-var">bind_list</span></a></span></span><span>
</span><span id="line-602"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098242"><span class="hs-identifier hs-var">loc</span></a></span><span>                              </span><span class="annot"><span class="annottext">(TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
 -&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId]))
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-603"></span><span>    </span><span class="annot"><span class="annottext">TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
forall r. TcRn r -&gt; TcRn r -&gt; TcRn r
</span><a href="GHC.Tc.Utils.Monad.html#recoverM"><span class="hs-identifier hs-var">recoverM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Name] -&gt; TcSigFun -&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="GHC.Tc.Gen.Bind.html#recoveryCode"><span class="hs-identifier hs-var">recoveryCode</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
[IdP (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098239"><span class="hs-identifier hs-var">binder_names</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098249"><span class="hs-identifier hs-var">sig_fn</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
 -&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId]))
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-604"></span><span>        </span><span class="hs-comment">-- Set up main recover; take advantage of any type sigs</span><span>
</span><span id="line-605"></span><span>
</span><span id="line-606"></span><span>    </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;------------------------------------------------&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">Outputable.empty</span></a></span><span>
</span><span id="line-607"></span><span>    </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Bindings for {&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Name] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
[IdP (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098239"><span class="hs-identifier hs-var">binder_names</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-608"></span><span>    </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098237"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681098237"><span class="hs-identifier hs-var">dflags</span></a></span></span><span>   </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) DynFlags
forall (m :: * -&gt; *). HasDynFlags m =&gt; m DynFlags
</span><a href="GHC.Driver.Session.html#getDynFlags"><span class="hs-identifier hs-var">getDynFlags</span></a></span><span>
</span><span id="line-609"></span><span>    </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098235"><span class="annot"><span class="annottext">plan :: GeneralisationPlan
</span><a href="#local-6989586621681098235"><span class="hs-identifier hs-var hs-var">plan</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; IsGroupClosed
-&gt; TcSigFun
-&gt; GeneralisationPlan
</span><a href="GHC.Tc.Gen.Bind.html#decideGeneralisationPlan"><span class="hs-identifier hs-var">decideGeneralisationPlan</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681098237"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098244"><span class="hs-identifier hs-var">bind_list</span></a></span><span> </span><span class="annot"><span class="annottext">IsGroupClosed
</span><a href="#local-6989586621681098245"><span class="hs-identifier hs-var">closed</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098249"><span class="hs-identifier hs-var">sig_fn</span></a></span><span>
</span><span id="line-610"></span><span>    </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Generalisation plan&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GeneralisationPlan -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralisationPlan
</span><a href="#local-6989586621681098235"><span class="hs-identifier hs-var">plan</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-611"></span><span>    </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098233"><span class="annot"><span class="annottext">result :: (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="#local-6989586621681098233"><span class="hs-identifier hs-var">result</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098232"><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098232"><span class="hs-identifier hs-var">poly_ids</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">GeneralisationPlan
</span><a href="#local-6989586621681098235"><span class="hs-identifier hs-var">plan</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-612"></span><span>         </span><span class="annot"><span class="annottext">GeneralisationPlan
</span><a href="GHC.Tc.Gen.Bind.html#NoGen"><span class="hs-identifier hs-var">NoGen</span></a></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RecFlag
-&gt; TcPragEnv
-&gt; TcSigFun
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="GHC.Tc.Gen.Bind.html#tcPolyNoGen"><span class="hs-identifier hs-var">tcPolyNoGen</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681098246"><span class="hs-identifier hs-var">rec_tc</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098248"><span class="hs-identifier hs-var">prag_fn</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098249"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098244"><span class="hs-identifier hs-var">bind_list</span></a></span><span>
</span><span id="line-613"></span><span>         </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#InferGen"><span class="hs-identifier hs-type">InferGen</span></a></span><span> </span><span id="local-6989586621681098228"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681098228"><span class="hs-identifier hs-var">mn</span></a></span></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">RecFlag
-&gt; TcPragEnv
-&gt; TcSigFun
-&gt; Bool
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="GHC.Tc.Gen.Bind.html#tcPolyInfer"><span class="hs-identifier hs-var">tcPolyInfer</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681098246"><span class="hs-identifier hs-var">rec_tc</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098248"><span class="hs-identifier hs-var">prag_fn</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098249"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681098228"><span class="hs-identifier hs-var">mn</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098244"><span class="hs-identifier hs-var">bind_list</span></a></span><span>
</span><span id="line-614"></span><span>         </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#CheckGen"><span class="hs-identifier hs-type">CheckGen</span></a></span><span> </span><span id="local-6989586621681098225"><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098225"><span class="hs-identifier hs-var">lbind</span></a></span></span><span> </span><span id="local-6989586621681098224"><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681098224"><span class="hs-identifier hs-var">sig</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcPragEnv
-&gt; TcIdSigInfo
-&gt; LHsBind (GhcPass 'Renamed)
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="GHC.Tc.Gen.Bind.html#tcPolyCheck"><span class="hs-identifier hs-var">tcPolyCheck</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098248"><span class="hs-identifier hs-var">prag_fn</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681098224"><span class="hs-identifier hs-var">sig</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098225"><span class="hs-identifier hs-var">lbind</span></a></span><span>
</span><span id="line-615"></span><span>
</span><span id="line-616"></span><span>    </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;} End of bindings for&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">[Name] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
[IdP (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098239"><span class="hs-identifier hs-var">binder_names</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RecFlag -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681098247"><span class="hs-identifier hs-var">rec_group</span></a></span><span>
</span><span id="line-617"></span><span>                                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TcId -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098223"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098223"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681098223"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098223"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098232"><span class="hs-identifier hs-var">poly_ids</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-618"></span><span>                                          </span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-619"></span><span>
</span><span id="line-620"></span><span>    </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Typechecked), [TcId])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="#local-6989586621681098233"><span class="hs-identifier hs-var">result</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-621"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-622"></span><span>    </span><span id="local-6989586621681098239"><span class="annot"><span class="annottext">binder_names :: [IdP (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098239"><span class="hs-identifier hs-var hs-var">binder_names</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)] -&gt; [IdP (GhcPass 'Renamed)]
forall p idR. CollectPass p =&gt; [LHsBindLR p idR] -&gt; [IdP p]
</span><a href="GHC.Hs.Utils.html#collectHsBindListBinders"><span class="hs-identifier hs-var">collectHsBindListBinders</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098244"><span class="hs-identifier hs-var">bind_list</span></a></span><span>
</span><span id="line-623"></span><span>    </span><span id="local-6989586621681098242"><span class="annot"><span class="annottext">loc :: SrcSpan
</span><a href="#local-6989586621681098242"><span class="hs-identifier hs-var hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(SrcSpan -&gt; SrcSpan -&gt; SrcSpan) -&gt; [SrcSpan] -&gt; SrcSpan
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; a -&gt; a) -&gt; t a -&gt; a
</span><a href="../../base/src/Data.Foldable.html#foldr1"><span class="hs-identifier hs-var">foldr1</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; SrcSpan -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#combineSrcSpans"><span class="hs-identifier hs-var">combineSrcSpans</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LHsBind (GhcPass 'Renamed) -&gt; SrcSpan)
-&gt; [LHsBind (GhcPass 'Renamed)] -&gt; [SrcSpan]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed) -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098244"><span class="hs-identifier hs-var">bind_list</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-624"></span><span>         </span><span class="hs-comment">-- The mbinds have been dependency analysed and</span><span>
</span><span id="line-625"></span><span>         </span><span class="hs-comment">-- may no longer be adjacent; so find the narrowest</span><span>
</span><span id="line-626"></span><span>         </span><span class="hs-comment">-- span that includes them all</span><span>
</span><span id="line-627"></span><span>
</span><span id="line-628"></span><span class="hs-comment">--------------</span><span>
</span><span id="line-629"></span><span class="hs-comment">-- If typechecking the binds fails, then return with each</span><span>
</span><span id="line-630"></span><span class="hs-comment">-- signature-less binder given type (forall a.a), to minimise</span><span>
</span><span id="line-631"></span><span class="hs-comment">-- subsequent error messages</span><span>
</span><span id="line-632"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#recoveryCode"><span class="hs-identifier hs-type">recoveryCode</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier hs-type">TcSigFun</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-633"></span><span id="recoveryCode"><span class="annot"><span class="annottext">recoveryCode :: [Name] -&gt; TcSigFun -&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="GHC.Tc.Gen.Bind.html#recoveryCode"><span class="hs-identifier hs-var hs-var">recoveryCode</span></a></span></span><span> </span><span id="local-6989586621681098218"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681098218"><span class="hs-identifier hs-var">binder_names</span></a></span></span><span> </span><span id="local-6989586621681098217"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098217"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span>
</span><span id="line-634"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcBindsWithSigs: error recovery&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Name] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681098218"><span class="hs-identifier hs-var">binder_names</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-635"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098216"><span class="annot"><span class="annottext">poly_ids :: [TcId]
</span><a href="#local-6989586621681098216"><span class="hs-identifier hs-var hs-var">poly_ids</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; TcId) -&gt; [Name] -&gt; [TcId]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcId
</span><a href="#local-6989586621681098215"><span class="hs-identifier hs-var">mk_dummy</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681098218"><span class="hs-identifier hs-var">binder_names</span></a></span><span>
</span><span id="line-636"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Typechecked), [TcId])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098216"><span class="hs-identifier hs-var">poly_ids</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-637"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-638"></span><span>    </span><span id="local-6989586621681098215"><span class="annot"><span class="annottext">mk_dummy :: Name -&gt; TcId
</span><a href="#local-6989586621681098215"><span class="hs-identifier hs-var hs-var">mk_dummy</span></a></span></span><span> </span><span id="local-6989586621681098214"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098214"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-639"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681098213"><span class="annot"><span class="annottext">TcSigInfo
</span><a href="#local-6989586621681098213"><span class="hs-identifier hs-var">sig</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098217"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098214"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-640"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681098212"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098212"><span class="hs-identifier hs-var">poly_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcSigInfo -&gt; Maybe TcId
</span><a href="GHC.Tc.Gen.Sig.html#completeSigPolyId_maybe"><span class="hs-identifier hs-var">completeSigPolyId_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigInfo
</span><a href="#local-6989586621681098213"><span class="hs-identifier hs-var">sig</span></a></span><span>
</span><span id="line-641"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098212"><span class="hs-identifier hs-var">poly_id</span></a></span><span>
</span><span id="line-642"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-643"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Kind -&gt; Kind -&gt; TcId
Name -&gt; Kind -&gt; Kind -&gt; TcId
</span><a href="GHC.Types.Id.html#mkLocalId"><span class="hs-identifier hs-var">mkLocalId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098214"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="GHC.Tc.Gen.Bind.html#forall_a_a"><span class="hs-identifier hs-var">forall_a_a</span></a></span><span>
</span><span id="line-644"></span><span>
</span><span id="line-645"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#forall_a_a"><span class="hs-identifier hs-type">forall_a_a</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span>
</span><span id="line-646"></span><span class="hs-comment">-- At one point I had (forall r (a :: TYPE r). a), but of course</span><span>
</span><span id="line-647"></span><span class="hs-comment">-- that type is ill-formed: its mentions 'r' which escapes r's scope.</span><span>
</span><span id="line-648"></span><span class="hs-comment">-- Another alternative would be (forall (a :: TYPE kappa). a), where</span><span>
</span><span id="line-649"></span><span class="hs-comment">-- kappa is a unification variable. But I don't think we need that</span><span>
</span><span id="line-650"></span><span class="hs-comment">-- complication here. I'm going to just use (forall (a::*). a).</span><span>
</span><span id="line-651"></span><span class="hs-comment">-- See #15276</span><span>
</span><span id="line-652"></span><span id="forall_a_a"><span class="annot"><span class="annottext">forall_a_a :: Kind
</span><a href="GHC.Tc.Gen.Bind.html#forall_a_a"><span class="hs-identifier hs-var hs-var">forall_a_a</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TcId] -&gt; Kind -&gt; Kind
</span><a href="GHC.Core.Type.html#mkSpecForAllTys"><span class="hs-identifier hs-var">mkSpecForAllTys</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TcId
</span><a href="GHC.Builtin.Types.Prim.html#alphaTyVar"><span class="hs-identifier hs-var">alphaTyVar</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="GHC.Builtin.Types.Prim.html#alphaTy"><span class="hs-identifier hs-var">alphaTy</span></a></span><span>
</span><span id="line-653"></span><span>
</span><span id="line-654"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
                         tcPolyNoGen
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-659"></span><span>
</span><span id="line-660"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcPolyNoGen"><span class="hs-identifier hs-type">tcPolyNoGen</span></a></span><span>     </span><span class="hs-comment">-- No generalisation whatsoever</span><span>
</span><span id="line-661"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span>       </span><span class="hs-comment">-- Whether it's recursive after breaking</span><span>
</span><span id="line-662"></span><span>                   </span><span class="hs-comment">-- dependencies based on type signatures</span><span>
</span><span id="line-663"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html#TcPragEnv"><span class="hs-identifier hs-type">TcPragEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier hs-type">TcSigFun</span></a></span><span>
</span><span id="line-664"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBind"><span class="hs-identifier hs-type">LHsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-665"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-666"></span><span>
</span><span id="line-667"></span><span id="tcPolyNoGen"><span class="annot"><span class="annottext">tcPolyNoGen :: RecFlag
-&gt; TcPragEnv
-&gt; TcSigFun
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="GHC.Tc.Gen.Bind.html#tcPolyNoGen"><span class="hs-identifier hs-var hs-var">tcPolyNoGen</span></a></span></span><span> </span><span id="local-6989586621681098203"><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681098203"><span class="hs-identifier hs-var">rec_tc</span></a></span></span><span> </span><span id="local-6989586621681098202"><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098202"><span class="hs-identifier hs-var">prag_fn</span></a></span></span><span> </span><span id="local-6989586621681098201"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098201"><span class="hs-identifier hs-var">tc_sig_fn</span></a></span></span><span> </span><span id="local-6989586621681098200"><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098200"><span class="hs-identifier hs-var">bind_list</span></a></span></span><span>
</span><span id="line-668"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098199"><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098199"><span class="hs-identifier hs-var">binds'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098198"><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681098198"><span class="hs-identifier hs-var">mono_infos</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RecFlag
-&gt; TcSigFun
-&gt; LetBndrSpec
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
</span><a href="GHC.Tc.Gen.Bind.html#tcMonoBinds"><span class="hs-identifier hs-var">tcMonoBinds</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681098203"><span class="hs-identifier hs-var">rec_tc</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098201"><span class="hs-identifier hs-var">tc_sig_fn</span></a></span><span>
</span><span id="line-669"></span><span>                                             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcPragEnv -&gt; LetBndrSpec
</span><a href="GHC.Tc.Gen.Pat.html#LetGblBndr"><span class="hs-identifier hs-var">LetGblBndr</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098202"><span class="hs-identifier hs-var">prag_fn</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-670"></span><span>                                             </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098200"><span class="hs-identifier hs-var">bind_list</span></a></span><span>
</span><span id="line-671"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098195"><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098195"><span class="hs-identifier hs-var">mono_ids'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(MonoBindInfo -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId)
-&gt; [MonoBindInfo] -&gt; TcM [TcId]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">MonoBindInfo -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="#local-6989586621681098194"><span class="hs-identifier hs-var">tc_mono_info</span></a></span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681098198"><span class="hs-identifier hs-var">mono_infos</span></a></span><span>
</span><span id="line-672"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Typechecked), [TcId])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098199"><span class="hs-identifier hs-var">binds'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098195"><span class="hs-identifier hs-var">mono_ids'</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-673"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-674"></span><span>    </span><span id="local-6989586621681098194"><span class="annot"><span class="annottext">tc_mono_info :: MonoBindInfo -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="#local-6989586621681098194"><span class="hs-identifier hs-var hs-var">tc_mono_info</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MBI"><span class="hs-identifier hs-type">MBI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mbi_poly_name :: MonoBindInfo -&gt; Name
</span><a href="GHC.Tc.Gen.Bind.html#mbi_poly_name"><span class="hs-identifier hs-var">mbi_poly_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681098191"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098191"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_mono_id :: MonoBindInfo -&gt; TcId
</span><a href="GHC.Tc.Gen.Bind.html#mbi_mono_id"><span class="hs-identifier hs-var">mbi_mono_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681098189"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098189"><span class="hs-identifier hs-var">mono_id</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-675"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681098188"><span class="annot"><span class="annottext">[LTcSpecPrag]
</span><a href="#local-6989586621681098188"><span class="hs-identifier hs-var">_specs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcId -&gt; [LSig (GhcPass 'Renamed)] -&gt; TcM [LTcSpecPrag]
</span><a href="GHC.Tc.Gen.Sig.html#tcSpecPrags"><span class="hs-identifier hs-var">tcSpecPrags</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098189"><span class="hs-identifier hs-var">mono_id</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcPragEnv -&gt; Name -&gt; [LSig (GhcPass 'Renamed)]
</span><a href="GHC.Tc.Gen.Sig.html#lookupPragEnv"><span class="hs-identifier hs-var">lookupPragEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098202"><span class="hs-identifier hs-var">prag_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098191"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-676"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcId -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098189"><span class="hs-identifier hs-var">mono_id</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-677"></span><span>           </span><span class="hs-comment">-- NB: tcPrags generates error messages for</span><span>
</span><span id="line-678"></span><span>           </span><span class="hs-comment">--     specialisation pragmas for non-overloaded sigs</span><span>
</span><span id="line-679"></span><span>           </span><span class="hs-comment">-- Indeed that is why we call it here!</span><span>
</span><span id="line-680"></span><span>           </span><span class="hs-comment">-- So we can safely ignore _specs</span><span>
</span><span id="line-681"></span><span>
</span><span id="line-682"></span><span>
</span><span id="line-683"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
                         tcPolyCheck
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-688"></span><span>
</span><span id="line-689"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcPolyCheck"><span class="hs-identifier hs-type">tcPolyCheck</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html#TcPragEnv"><span class="hs-identifier hs-type">TcPragEnv</span></a></span><span>
</span><span id="line-690"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInfo"><span class="hs-identifier hs-type">TcIdSigInfo</span></a></span><span>     </span><span class="hs-comment">-- Must be a complete signature</span><span>
</span><span id="line-691"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBind"><span class="hs-identifier hs-type">LHsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span>   </span><span class="hs-comment">-- Must be a FunBind</span><span>
</span><span id="line-692"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-693"></span><span class="hs-comment">-- There is just one binding,</span><span>
</span><span id="line-694"></span><span class="hs-comment">--   it is a FunBind</span><span>
</span><span id="line-695"></span><span class="hs-comment">--   it has a complete type signature,</span><span>
</span><span id="line-696"></span><span id="tcPolyCheck"><span class="annot"><span class="annottext">tcPolyCheck :: TcPragEnv
-&gt; TcIdSigInfo
-&gt; LHsBind (GhcPass 'Renamed)
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="GHC.Tc.Gen.Bind.html#tcPolyCheck"><span class="hs-identifier hs-var hs-var">tcPolyCheck</span></a></span></span><span> </span><span id="local-6989586621681098185"><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098185"><span class="hs-identifier hs-var">prag_fn</span></a></span></span><span>
</span><span id="line-697"></span><span>            </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#CompleteSig"><span class="hs-identifier hs-type">CompleteSig</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sig_bndr :: TcIdSigInfo -&gt; TcId
</span><a href="GHC.Tc.Types.html#sig_bndr"><span class="hs-identifier hs-var">sig_bndr</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681098182"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098182"><span class="hs-identifier hs-var">poly_id</span></a></span></span><span>
</span><span id="line-698"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">sig_ctxt :: TcIdSigInfo -&gt; UserTypeCtxt
</span><a href="GHC.Tc.Types.html#sig_ctxt"><span class="hs-identifier hs-var">sig_ctxt</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681098180"><span class="annot"><span class="annottext">UserTypeCtxt
</span><a href="#local-6989586621681098180"><span class="hs-identifier hs-var">ctxt</span></a></span></span><span>
</span><span id="line-699"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">sig_loc :: TcIdSigInfo -&gt; SrcSpan
</span><a href="GHC.Tc.Types.html#sig_loc"><span class="hs-identifier hs-var">sig_loc</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681098178"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098178"><span class="hs-identifier hs-var">sig_loc</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-700"></span><span>            </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681098177"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098177"><span class="hs-identifier hs-var">bind_loc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#FunBind"><span class="hs-identifier hs-type">FunBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">fun_id :: forall idL idR. HsBindLR idL idR -&gt; Located (IdP idL)
</span><a href="GHC.Hs.Binds.html#fun_id"><span class="hs-identifier hs-var">fun_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681098175"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098175"><span class="hs-identifier hs-var">nm_loc</span></a></span></span><span> </span><span id="local-6989586621681098174"><span class="annot"><span class="annottext">IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681098174"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-701"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fun_matches :: forall idL idR. HsBindLR idL idR -&gt; MatchGroup idR (LHsExpr idR)
</span><a href="GHC.Hs.Binds.html#fun_matches"><span class="hs-identifier hs-var">fun_matches</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681098172"><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681098172"><span class="hs-identifier hs-var">matches</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-702"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcPolyCheck&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098182"><span class="hs-identifier hs-var">poly_id</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098178"><span class="hs-identifier hs-var">sig_loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-703"></span><span>
</span><span id="line-704"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098171"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098171"><span class="hs-identifier hs-var">mono_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; SrcSpan -&gt; TcM Name
</span><a href="GHC.Tc.Utils.Monad.html#newNameAt"><span class="hs-identifier hs-var">newNameAt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; OccName
</span><a href="GHC.Types.Name.html#nameOccName"><span class="hs-identifier hs-var">nameOccName</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681098174"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098175"><span class="hs-identifier hs-var">nm_loc</span></a></span><span>
</span><span id="line-705"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098168"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681098168"><span class="hs-identifier hs-var">wrap_gen</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098167"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681098167"><span class="hs-identifier hs-var">wrap_res</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098166"><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681098166"><span class="hs-identifier hs-var">matches'</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-706"></span><span>             </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; TcRn
     (HsWrapper,
      (HsWrapper,
       MatchGroup
         (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
-&gt; TcRn
     (HsWrapper,
      (HsWrapper,
       MatchGroup
         (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098178"><span class="hs-identifier hs-var">sig_loc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRn
   (HsWrapper,
    (HsWrapper,
     MatchGroup
       (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
 -&gt; TcRn
      (HsWrapper,
       (HsWrapper,
        MatchGroup
          (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))))
-&gt; TcRn
     (HsWrapper,
      (HsWrapper,
       MatchGroup
         (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
-&gt; TcRn
     (HsWrapper,
      (HsWrapper,
       MatchGroup
         (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-comment">-- Sets the binding location for the skolems</span><span>
</span><span id="line-707"></span><span>                </span><span class="annot"><span class="annottext">UserTypeCtxt
-&gt; Kind
-&gt; (Kind
    -&gt; TcM
         (HsWrapper,
          MatchGroup
            (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
-&gt; TcRn
     (HsWrapper,
      (HsWrapper,
       MatchGroup
         (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
forall result.
UserTypeCtxt
-&gt; Kind -&gt; (Kind -&gt; TcM result) -&gt; TcM (HsWrapper, result)
</span><a href="GHC.Tc.Utils.Unify.html#tcSkolemiseScoped"><span class="hs-identifier hs-var">tcSkolemiseScoped</span></a></span><span> </span><span class="annot"><span class="annottext">UserTypeCtxt
</span><a href="#local-6989586621681098180"><span class="hs-identifier hs-var">ctxt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098182"><span class="hs-identifier hs-var">poly_id</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">((Kind
  -&gt; TcM
       (HsWrapper,
        MatchGroup
          (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
 -&gt; TcRn
      (HsWrapper,
       (HsWrapper,
        MatchGroup
          (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))))
-&gt; (Kind
    -&gt; TcM
         (HsWrapper,
          MatchGroup
            (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
-&gt; TcRn
     (HsWrapper,
      (HsWrapper,
       MatchGroup
         (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681098164"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098164"><span class="hs-identifier hs-var">rho_ty</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-708"></span><span>                </span><span class="hs-comment">-- Unwraps multiple layers; e.g</span><span>
</span><span id="line-709"></span><span>                </span><span class="hs-comment">--    f :: forall a. Eq a =&gt; forall b. Ord b =&gt; blah</span><span>
</span><span id="line-710"></span><span>                </span><span class="hs-comment">-- NB: tcSkolemise makes fresh type variables</span><span>
</span><span id="line-711"></span><span>                </span><span class="hs-comment">-- See Note [Instantiate sig with fresh variables]</span><span>
</span><span id="line-712"></span><span>
</span><span id="line-713"></span><span>                </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098163"><span class="annot"><span class="annottext">mono_id :: TcId
</span><a href="#local-6989586621681098163"><span class="hs-identifier hs-var hs-var">mono_id</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Kind -&gt; Kind -&gt; TcId
Name -&gt; Kind -&gt; Kind -&gt; TcId
</span><a href="GHC.Types.Id.html#mkLocalId"><span class="hs-identifier hs-var">mkLocalId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098171"><span class="hs-identifier hs-var">mono_name</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Var.html#varMult"><span class="hs-identifier hs-var hs-var">varMult</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098182"><span class="hs-identifier hs-var">poly_id</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098164"><span class="hs-identifier hs-var">rho_ty</span></a></span><span> </span><span class="hs-keyword">in</span><span>
</span><span id="line-714"></span><span>                </span><span class="annot"><span class="annottext">[TcBinder]
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
forall a. [TcBinder] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendBinderStack"><span class="hs-identifier hs-var">tcExtendBinderStack</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TcId -&gt; TopLevelFlag -&gt; TcBinder
</span><a href="GHC.Tc.Types.html#TcIdBndr"><span class="hs-identifier hs-var">TcIdBndr</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098163"><span class="hs-identifier hs-var">mono_id</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="GHC.Types.Basic.html#NotTopLevel"><span class="hs-identifier hs-var">NotTopLevel</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(TcM
   (HsWrapper,
    MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
 -&gt; TcM
      (HsWrapper,
       MatchGroup
         (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-715"></span><span>                </span><span class="hs-comment">-- Why mono_id in the BinderStack?</span><span>
</span><span id="line-716"></span><span>                </span><span class="hs-comment">--    See Note [Relevant bindings and the binder stack]</span><span>
</span><span id="line-717"></span><span>
</span><span id="line-718"></span><span>                </span><span class="annot"><span class="annottext">SrcSpan
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098177"><span class="hs-identifier hs-var">bind_loc</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM
   (HsWrapper,
    MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
 -&gt; TcM
      (HsWrapper,
       MatchGroup
         (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-719"></span><span>                </span><span class="annot"><span class="annottext">Located Name
-&gt; MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
-&gt; ExpSigmaType
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
</span><a href="GHC.Tc.Gen.Match.html#tcMatchesFun"><span class="hs-identifier hs-var">tcMatchesFun</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; Name -&gt; Located Name
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098175"><span class="hs-identifier hs-var">nm_loc</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098171"><span class="hs-identifier hs-var">mono_name</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681098172"><span class="hs-identifier hs-var">matches</span></a></span><span>
</span><span id="line-720"></span><span>                             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098164"><span class="hs-identifier hs-var">rho_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-721"></span><span>
</span><span id="line-722"></span><span>       </span><span class="hs-comment">-- We make a funny AbsBinds, abstracting over nothing,</span><span>
</span><span id="line-723"></span><span>       </span><span class="hs-comment">-- just so we haev somewhere to put the SpecPrags.</span><span>
</span><span id="line-724"></span><span>       </span><span class="hs-comment">-- Otherwise we could just use the FunBind</span><span>
</span><span id="line-725"></span><span>       </span><span class="hs-comment">-- Hence poly_id2 is just a clone of poly_id;</span><span>
</span><span id="line-726"></span><span>       </span><span class="hs-comment">-- We re-use mono-name, but we could equally well use a fresh one</span><span>
</span><span id="line-727"></span><span>
</span><span id="line-728"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098158"><span class="annot"><span class="annottext">prag_sigs :: [LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098158"><span class="hs-identifier hs-var hs-var">prag_sigs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcPragEnv -&gt; Name -&gt; [LSig (GhcPass 'Renamed)]
</span><a href="GHC.Tc.Gen.Sig.html#lookupPragEnv"><span class="hs-identifier hs-var">lookupPragEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098185"><span class="hs-identifier hs-var">prag_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681098174"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-729"></span><span>             </span><span id="local-6989586621681098157"><span class="annot"><span class="annottext">poly_id2 :: TcId
</span><a href="#local-6989586621681098157"><span class="hs-identifier hs-var hs-var">poly_id2</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Kind -&gt; Kind -&gt; TcId
Name -&gt; Kind -&gt; Kind -&gt; TcId
</span><a href="GHC.Types.Id.html#mkLocalId"><span class="hs-identifier hs-var">mkLocalId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098171"><span class="hs-identifier hs-var">mono_name</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idMult"><span class="hs-identifier hs-var">idMult</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098182"><span class="hs-identifier hs-var">poly_id</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098182"><span class="hs-identifier hs-var">poly_id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-730"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098155"><span class="annot"><span class="annottext">[LTcSpecPrag]
</span><a href="#local-6989586621681098155"><span class="hs-identifier hs-var">spec_prags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcId -&gt; [LSig (GhcPass 'Renamed)] -&gt; TcM [LTcSpecPrag]
</span><a href="GHC.Tc.Gen.Sig.html#tcSpecPrags"><span class="hs-identifier hs-var">tcSpecPrags</span></a></span><span>    </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098182"><span class="hs-identifier hs-var">poly_id</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098158"><span class="hs-identifier hs-var">prag_sigs</span></a></span><span>
</span><span id="line-731"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098154"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098154"><span class="hs-identifier hs-var">poly_id</span></a></span></span><span>    </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcId
-&gt; [LSig (GhcPass 'Renamed)] -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="GHC.Tc.Gen.Sig.html#addInlinePrags"><span class="hs-identifier hs-var">addInlinePrags</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098182"><span class="hs-identifier hs-var">poly_id</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098158"><span class="hs-identifier hs-var">prag_sigs</span></a></span><span>
</span><span id="line-732"></span><span>
</span><span id="line-733"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098152"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681098152"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) Module
forall (m :: * -&gt; *). HasModule m =&gt; m Module
</span><a href="GHC.Unit.Module.html#getModule"><span class="hs-identifier hs-var">getModule</span></a></span><span>
</span><span id="line-734"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098150"><span class="annot"><span class="annottext">[Tickish TcId]
</span><a href="#local-6989586621681098150"><span class="hs-identifier hs-var">tick</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; TcId
-&gt; Module
-&gt; [LSig (GhcPass 'Renamed)]
-&gt; TcM [Tickish TcId]
</span><a href="GHC.Tc.Gen.Bind.html#funBindTicks"><span class="hs-identifier hs-var">funBindTicks</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098175"><span class="hs-identifier hs-var">nm_loc</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098154"><span class="hs-identifier hs-var">poly_id</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681098152"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098158"><span class="hs-identifier hs-var">prag_sigs</span></a></span><span>
</span><span id="line-735"></span><span>
</span><span id="line-736"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098148"><span class="annot"><span class="annottext">bind' :: HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098148"><span class="hs-identifier hs-var hs-var">bind'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FunBind :: forall idL idR.
XFunBind idL idR
-&gt; Located (IdP idL)
-&gt; MatchGroup idR (LHsExpr idR)
-&gt; [Tickish TcId]
-&gt; HsBindLR idL idR
</span><a href="GHC.Hs.Binds.html#FunBind"><span class="hs-identifier hs-type">FunBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">fun_id :: Located (IdP (GhcPass 'Typechecked))
</span><a href="GHC.Hs.Binds.html#fun_id"><span class="hs-identifier hs-var">fun_id</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; TcId -&gt; GenLocated SrcSpan TcId
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098175"><span class="hs-identifier hs-var">nm_loc</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098157"><span class="hs-identifier hs-var">poly_id2</span></a></span><span>
</span><span id="line-737"></span><span>                             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fun_matches :: MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Hs.Binds.html#fun_matches"><span class="hs-identifier hs-var">fun_matches</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681098166"><span class="hs-identifier hs-var">matches'</span></a></span><span>
</span><span id="line-738"></span><span>                             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fun_ext :: XFunBind (GhcPass 'Typechecked) (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#fun_ext"><span class="hs-identifier hs-var">fun_ext</span></a></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681098168"><span class="hs-identifier hs-var">wrap_gen</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; HsWrapper -&gt; HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#%3C.%3E"><span class="hs-operator hs-var">&lt;.&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681098167"><span class="hs-identifier hs-var">wrap_res</span></a></span><span>
</span><span id="line-739"></span><span>                             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fun_tick :: [Tickish TcId]
</span><a href="GHC.Hs.Binds.html#fun_tick"><span class="hs-identifier hs-var">fun_tick</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Tickish TcId]
</span><a href="#local-6989586621681098150"><span class="hs-identifier hs-var">tick</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-740"></span><span>
</span><span id="line-741"></span><span>             </span><span id="local-6989586621681098145"><span class="annot"><span class="annottext">export :: ABExport (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098145"><span class="hs-keyword hs-var hs-var">export</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ABE :: forall p.
XABE p -&gt; IdP p -&gt; IdP p -&gt; HsWrapper -&gt; TcSpecPrags -&gt; ABExport p
</span><a href="GHC.Hs.Binds.html#ABE"><span class="hs-identifier hs-type">ABE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">abe_ext :: XABE (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#abe_ext"><span class="hs-identifier hs-var">abe_ext</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NoExtField
XABE (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span>
</span><span id="line-742"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abe_wrap :: HsWrapper
</span><a href="GHC.Hs.Binds.html#abe_wrap"><span class="hs-identifier hs-var">abe_wrap</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#idHsWrapper"><span class="hs-identifier hs-var">idHsWrapper</span></a></span><span>
</span><span id="line-743"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abe_poly :: IdP (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#abe_poly"><span class="hs-identifier hs-var">abe_poly</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcId
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098154"><span class="hs-identifier hs-var">poly_id</span></a></span><span>
</span><span id="line-744"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abe_mono :: IdP (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#abe_mono"><span class="hs-identifier hs-var">abe_mono</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcId
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098157"><span class="hs-identifier hs-var">poly_id2</span></a></span><span>
</span><span id="line-745"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abe_prags :: TcSpecPrags
</span><a href="GHC.Hs.Binds.html#abe_prags"><span class="hs-identifier hs-var">abe_prags</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LTcSpecPrag] -&gt; TcSpecPrags
</span><a href="GHC.Hs.Binds.html#SpecPrags"><span class="hs-identifier hs-var">SpecPrags</span></a></span><span> </span><span class="annot"><span class="annottext">[LTcSpecPrag]
</span><a href="#local-6989586621681098155"><span class="hs-identifier hs-var">spec_prags</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-746"></span><span>
</span><span id="line-747"></span><span>             </span><span id="local-6989586621681098136"><span class="annot"><span class="annottext">abs_bind :: GenLocated
  SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
</span><a href="#local-6989586621681098136"><span class="hs-identifier hs-var hs-var">abs_bind</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; GenLocated
     SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098177"><span class="hs-identifier hs-var">bind_loc</span></a></span><span> </span><span class="annot"><span class="annottext">(HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
 -&gt; GenLocated
      SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)))
-&gt; HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; GenLocated
     SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-748"></span><span>                        </span><span class="annot"><span class="annottext">AbsBinds :: forall idL idR.
XAbsBinds idL idR
-&gt; [TcId]
-&gt; [TcId]
-&gt; [ABExport idL]
-&gt; [TcEvBinds]
-&gt; LHsBinds idL
-&gt; Bool
-&gt; HsBindLR idL idR
</span><a href="GHC.Hs.Binds.html#AbsBinds"><span class="hs-identifier hs-type">AbsBinds</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">abs_ext :: XAbsBinds (GhcPass 'Typechecked) (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#abs_ext"><span class="hs-identifier hs-var">abs_ext</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NoExtField
XAbsBinds (GhcPass 'Typechecked) (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span>
</span><span id="line-749"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abs_tvs :: [TcId]
</span><a href="GHC.Hs.Binds.html#abs_tvs"><span class="hs-identifier hs-var">abs_tvs</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-750"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abs_ev_vars :: [TcId]
</span><a href="GHC.Hs.Binds.html#abs_ev_vars"><span class="hs-identifier hs-var">abs_ev_vars</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-751"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abs_ev_binds :: [TcEvBinds]
</span><a href="GHC.Hs.Binds.html#abs_ev_binds"><span class="hs-identifier hs-var">abs_ev_binds</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-752"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abs_exports :: [ABExport (GhcPass 'Typechecked)]
</span><a href="GHC.Hs.Binds.html#abs_exports"><span class="hs-identifier hs-var">abs_exports</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">ABExport (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098145"><span class="hs-keyword hs-var">export</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-753"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abs_binds :: LHsBinds (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#abs_binds"><span class="hs-identifier hs-var">abs_binds</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GenLocated
  SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
-&gt; LHsBinds (GhcPass 'Typechecked)
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan
-&gt; HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; GenLocated
     SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098177"><span class="hs-identifier hs-var">bind_loc</span></a></span><span> </span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098148"><span class="hs-identifier hs-var">bind'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-754"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abs_sig :: Bool
</span><a href="GHC.Hs.Binds.html#abs_sig"><span class="hs-identifier hs-var">abs_sig</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-755"></span><span>
</span><span id="line-756"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Typechecked), [TcId])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated
  SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
-&gt; LHsBinds (GhcPass 'Typechecked)
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated
  SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
</span><a href="#local-6989586621681098136"><span class="hs-identifier hs-var">abs_bind</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098154"><span class="hs-identifier hs-var">poly_id</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-757"></span><span>
</span><span id="line-758"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcPolyCheck"><span class="hs-identifier hs-var">tcPolyCheck</span></a></span><span> </span><span id="local-6989586621681098126"><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098126"><span class="hs-identifier hs-var">_prag_fn</span></a></span></span><span> </span><span id="local-6989586621681098125"><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681098125"><span class="hs-identifier hs-var">sig</span></a></span></span><span> </span><span id="local-6989586621681098124"><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098124"><span class="hs-identifier hs-var">bind</span></a></span></span><span>
</span><span id="line-759"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcPolyCheck&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcIdSigInfo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681098125"><span class="hs-identifier hs-var">sig</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed) -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681098124"><span class="hs-identifier hs-var">bind</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-760"></span><span>
</span><span id="line-761"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#funBindTicks"><span class="hs-identifier hs-type">funBindTicks</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Binds.html#LSig"><span class="hs-identifier hs-type">LSig</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-762"></span><span>             </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Core.html#Tickish"><span class="hs-identifier hs-type">Tickish</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-763"></span><span id="funBindTicks"><span class="annot"><span class="annottext">funBindTicks :: SrcSpan
-&gt; TcId
-&gt; Module
-&gt; [LSig (GhcPass 'Renamed)]
-&gt; TcM [Tickish TcId]
</span><a href="GHC.Tc.Gen.Bind.html#funBindTicks"><span class="hs-identifier hs-var hs-var">funBindTicks</span></a></span></span><span> </span><span id="local-6989586621681098123"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098123"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681098122"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098122"><span class="hs-identifier hs-var">fun_id</span></a></span></span><span> </span><span id="local-6989586621681098121"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681098121"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span id="local-6989586621681098120"><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098120"><span class="hs-identifier hs-var">sigs</span></a></span></span><span>
</span><span id="line-764"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098119"><span class="annot"><span class="annottext">Maybe (Located StringLiteral)
</span><a href="#local-6989586621681098119"><span class="hs-identifier hs-var">mb_cc_str</span></a></span></span><span> </span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span> </span><span class="annot"><span class="annottext">[Maybe (Located StringLiteral)]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Maybe (Located StringLiteral)
</span><a href="#local-6989586621681098118"><span class="hs-identifier hs-var">cc_name</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#SCCFunSig"><span class="hs-identifier hs-type">SCCFunSig</span></a></span><span> </span><span class="annot"><span class="annottext">XSCCFunSig (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">SourceText
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Located (IdP (GhcPass 'Renamed))
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681098118"><span class="annot"><span class="annottext">Maybe (Located StringLiteral)
</span><a href="#local-6989586621681098118"><span class="hs-identifier hs-var">cc_name</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098120"><span class="hs-identifier hs-var">sigs</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-765"></span><span>      </span><span class="hs-comment">-- this can only be a singleton list, as duplicate pragmas are rejected</span><span>
</span><span id="line-766"></span><span>      </span><span class="hs-comment">-- by the renamer</span><span>
</span><span id="line-767"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098116"><span class="annot"><span class="annottext">cc_str :: FastString
</span><a href="#local-6989586621681098116"><span class="hs-identifier hs-var hs-var">cc_str</span></a></span></span><span>
</span><span id="line-768"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681098115"><span class="annot"><span class="annottext">Located StringLiteral
</span><a href="#local-6989586621681098115"><span class="hs-identifier hs-var">cc_str</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe (Located StringLiteral)
</span><a href="#local-6989586621681098119"><span class="hs-identifier hs-var">mb_cc_str</span></a></span><span>
</span><span id="line-769"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">StringLiteral -&gt; FastString
</span><a href="GHC.Types.Basic.html#sl_fs"><span class="hs-identifier hs-var hs-var">sl_fs</span></a></span><span> </span><span class="annot"><span class="annottext">(StringLiteral -&gt; FastString) -&gt; StringLiteral -&gt; FastString
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Located StringLiteral -&gt; StringLiteral
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located StringLiteral
</span><a href="#local-6989586621681098115"><span class="hs-identifier hs-var">cc_str</span></a></span><span>
</span><span id="line-770"></span><span>          </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-771"></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; FastString
forall a. NamedThing a =&gt; a -&gt; FastString
</span><a href="GHC.Types.Name.html#getOccFS"><span class="hs-identifier hs-var">getOccFS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Name
</span><a href="GHC.Types.Var.html#varName"><span class="hs-identifier hs-var hs-var">Var.varName</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098122"><span class="hs-identifier hs-var">fun_id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-772"></span><span>        </span><span id="local-6989586621681098111"><span class="annot"><span class="annottext">cc_name :: FastString
</span><a href="#local-6989586621681098111"><span class="hs-identifier hs-var hs-var">cc_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; FastString
</span><a href="GHC.Unit.Module.Name.html#moduleNameFS"><span class="hs-identifier hs-var">moduleNameFS</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Module -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681098121"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; FastString -&gt; FastString
</span><a href="GHC.Data.FastString.html#appendFS"><span class="hs-operator hs-var">`appendFS`</span></a></span><span> </span><span class="annot"><span class="annottext">Char -&gt; FastString -&gt; FastString
</span><a href="GHC.Data.FastString.html#consFS"><span class="hs-identifier hs-var">consFS</span></a></span><span> </span><span class="annot"><span class="annottext">Char
</span><span class="hs-char">'.'</span></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681098116"><span class="hs-identifier hs-var">cc_str</span></a></span><span>
</span><span id="line-773"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-774"></span><span>      </span><span id="local-6989586621681098106"><span class="annot"><span class="annottext">CCFlavour
</span><a href="#local-6989586621681098106"><span class="hs-identifier hs-var">flavour</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">CostCentreIndex -&gt; CCFlavour
</span><a href="GHC.Types.CostCentre.html#DeclCC"><span class="hs-identifier hs-var">DeclCC</span></a></span><span> </span><span class="annot"><span class="annottext">(CostCentreIndex -&gt; CCFlavour)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) CostCentreIndex
-&gt; IOEnv (Env TcGblEnv TcLclEnv) CCFlavour
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">FastString -&gt; IOEnv (Env TcGblEnv TcLclEnv) CostCentreIndex
forall gbl lcl.
ContainsCostCentreState gbl =&gt;
FastString -&gt; TcRnIf gbl lcl CostCentreIndex
</span><a href="GHC.Tc.Utils.Monad.html#getCCIndexM"><span class="hs-identifier hs-var">getCCIndexM</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681098111"><span class="hs-identifier hs-var">cc_name</span></a></span><span>
</span><span id="line-775"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098104"><span class="annot"><span class="annottext">cc :: CostCentre
</span><a href="#local-6989586621681098104"><span class="hs-identifier hs-var hs-var">cc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Module -&gt; SrcSpan -&gt; CCFlavour -&gt; CostCentre
</span><a href="GHC.Types.CostCentre.html#mkUserCC"><span class="hs-identifier hs-var">mkUserCC</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621681098111"><span class="hs-identifier hs-var">cc_name</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681098121"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098123"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">CCFlavour
</span><a href="#local-6989586621681098106"><span class="hs-identifier hs-var">flavour</span></a></span><span>
</span><span id="line-776"></span><span>      </span><span class="annot"><span class="annottext">[Tickish TcId] -&gt; TcM [Tickish TcId]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">CostCentre -&gt; Bool -&gt; Bool -&gt; Tickish TcId
forall id. CostCentre -&gt; Bool -&gt; Bool -&gt; Tickish id
</span><a href="GHC.Core.html#ProfNote"><span class="hs-identifier hs-var">ProfNote</span></a></span><span> </span><span class="annot"><span class="annottext">CostCentre
</span><a href="#local-6989586621681098104"><span class="hs-identifier hs-var">cc</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">]</span><span>
</span><span id="line-777"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-778"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Tickish TcId] -&gt; TcM [Tickish TcId]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-779"></span><span>
</span><span id="line-780"></span><span class="hs-comment">{- Note [Instantiate sig with fresh variables]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It's vital to instantiate a type signature with fresh variables.
For example:
      type T = forall a. [a] -&gt; [a]
      f :: T;
      f = g where { g :: T; g = &lt;rhs&gt; }

 We must not use the same 'a' from the defn of T at both places!!
(Instantiation is only necessary because of type synonyms.  Otherwise,
it's all cool; each signature has distinct type variables from the renamer.)
-}</span><span>
</span><span id="line-792"></span><span>
</span><span id="line-793"></span><span>
</span><span id="line-794"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
                         tcPolyInfer
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-799"></span><span>
</span><span id="line-800"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcPolyInfer"><span class="hs-identifier hs-type">tcPolyInfer</span></a></span><span>
</span><span id="line-801"></span><span>  </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span>       </span><span class="hs-comment">-- Whether it's recursive after breaking</span><span>
</span><span id="line-802"></span><span>                   </span><span class="hs-comment">-- dependencies based on type signatures</span><span>
</span><span id="line-803"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html#TcPragEnv"><span class="hs-identifier hs-type">TcPragEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier hs-type">TcSigFun</span></a></span><span>
</span><span id="line-804"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>         </span><span class="hs-comment">-- True &lt;=&gt; apply the monomorphism restriction</span><span>
</span><span id="line-805"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBind"><span class="hs-identifier hs-type">LHsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-806"></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-807"></span><span id="tcPolyInfer"><span class="annot"><span class="annottext">tcPolyInfer :: RecFlag
-&gt; TcPragEnv
-&gt; TcSigFun
-&gt; Bool
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
</span><a href="GHC.Tc.Gen.Bind.html#tcPolyInfer"><span class="hs-identifier hs-var hs-var">tcPolyInfer</span></a></span></span><span> </span><span id="local-6989586621681098102"><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681098102"><span class="hs-identifier hs-var">rec_tc</span></a></span></span><span> </span><span id="local-6989586621681098101"><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098101"><span class="hs-identifier hs-var">prag_fn</span></a></span></span><span> </span><span id="local-6989586621681098100"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098100"><span class="hs-identifier hs-var">tc_sig_fn</span></a></span></span><span> </span><span id="local-6989586621681098099"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681098099"><span class="hs-identifier hs-var">mono</span></a></span></span><span> </span><span id="local-6989586621681098098"><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098098"><span class="hs-identifier hs-var">bind_list</span></a></span></span><span>
</span><span id="line-808"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098097"><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621681098097"><span class="hs-identifier hs-var">tclvl</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098096"><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621681098096"><span class="hs-identifier hs-var">wanted</span></a></span></span><span class="hs-special">,</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098095"><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098095"><span class="hs-identifier hs-var">binds'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098094"><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681098094"><span class="hs-identifier hs-var">mono_infos</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-809"></span><span>             </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
-&gt; TcM
     (TcLevel, WantedConstraints,
      (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo]))
forall a. TcM a -&gt; TcM (TcLevel, WantedConstraints, a)
</span><a href="GHC.Tc.Utils.Monad.html#pushLevelAndCaptureConstraints"><span class="hs-identifier hs-var">pushLevelAndCaptureConstraints</span></a></span><span>  </span><span class="annot"><span class="annottext">(TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
 -&gt; TcM
      (TcLevel, WantedConstraints,
       (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])))
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
-&gt; TcM
     (TcLevel, WantedConstraints,
      (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo]))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-810"></span><span>                </span><span class="annot"><span class="annottext">RecFlag
-&gt; TcSigFun
-&gt; LetBndrSpec
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
</span><a href="GHC.Tc.Gen.Bind.html#tcMonoBinds"><span class="hs-identifier hs-var">tcMonoBinds</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681098102"><span class="hs-identifier hs-var">rec_tc</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681098100"><span class="hs-identifier hs-var">tc_sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="GHC.Tc.Gen.Pat.html#LetLclBndr"><span class="hs-identifier hs-var">LetLclBndr</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098098"><span class="hs-identifier hs-var">bind_list</span></a></span><span>
</span><span id="line-811"></span><span>
</span><span id="line-812"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098091"><span class="annot"><span class="annottext">name_taus :: [(Name, Kind)]
</span><a href="#local-6989586621681098091"><span class="hs-identifier hs-var hs-var">name_taus</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MonoBindInfo -&gt; Name
</span><a href="GHC.Tc.Gen.Bind.html#mbi_poly_name"><span class="hs-identifier hs-var hs-var">mbi_poly_name</span></a></span><span> </span><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681098090"><span class="hs-identifier hs-var">info</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MonoBindInfo -&gt; TcId
</span><a href="GHC.Tc.Gen.Bind.html#mbi_mono_id"><span class="hs-identifier hs-var hs-var">mbi_mono_id</span></a></span><span> </span><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681098090"><span class="hs-identifier hs-var">info</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-813"></span><span>                          </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681098090"><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681098090"><span class="hs-identifier hs-var">info</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681098094"><span class="hs-identifier hs-var">mono_infos</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-814"></span><span>             </span><span id="local-6989586621681098089"><span class="annot"><span class="annottext">sigs :: [TcIdSigInst]
</span><a href="#local-6989586621681098089"><span class="hs-identifier hs-var hs-var">sigs</span></a></span></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681098088"><span class="hs-identifier hs-var">sig</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MBI"><span class="hs-identifier hs-type">MBI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mbi_sig :: MonoBindInfo -&gt; Maybe TcIdSigInst
</span><a href="GHC.Tc.Gen.Bind.html#mbi_sig"><span class="hs-identifier hs-var">mbi_sig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681098088"><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681098088"><span class="hs-identifier hs-var">sig</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681098094"><span class="hs-identifier hs-var">mono_infos</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-815"></span><span>             </span><span id="local-6989586621681098086"><span class="annot"><span class="annottext">infer_mode :: InferMode
</span><a href="#local-6989586621681098086"><span class="hs-identifier hs-var hs-var">infer_mode</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681098099"><span class="hs-identifier hs-var">mono</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">InferMode
</span><a href="GHC.Tc.Solver.html#ApplyMR"><span class="hs-identifier hs-var">ApplyMR</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">InferMode
</span><a href="GHC.Tc.Solver.html#NoRestrictions"><span class="hs-identifier hs-var">NoRestrictions</span></a></span><span>
</span><span id="line-816"></span><span>
</span><span id="line-817"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TcIdSigInst -&gt; TcRn ()) -&gt; [TcIdSigInst] -&gt; TcRn ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; TcIdSigInst -&gt; TcRn ()
</span><a href="GHC.Tc.Gen.Bind.html#checkOverloadedSig"><span class="hs-identifier hs-var">checkOverloadedSig</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681098099"><span class="hs-identifier hs-var">mono</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[TcIdSigInst]
</span><a href="#local-6989586621681098089"><span class="hs-identifier hs-var">sigs</span></a></span><span>
</span><span id="line-818"></span><span>
</span><span id="line-819"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;simplifyInfer call&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcLevel -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621681098097"><span class="hs-identifier hs-var">tclvl</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, Kind)] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, Kind)]
</span><a href="#local-6989586621681098091"><span class="hs-identifier hs-var">name_taus</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621681098096"><span class="hs-identifier hs-var">wanted</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-820"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098081"><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098081"><span class="hs-identifier hs-var">qtvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098080"><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098080"><span class="hs-identifier hs-var">givens</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098079"><span class="annot"><span class="annottext">TcEvBinds
</span><a href="#local-6989586621681098079"><span class="hs-identifier hs-var">ev_binds</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098078"><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621681098078"><span class="hs-identifier hs-var">residual</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098077"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681098077"><span class="hs-identifier hs-var">insoluble</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-821"></span><span>                 </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcLevel
-&gt; InferMode
-&gt; [TcIdSigInst]
-&gt; [(Name, Kind)]
-&gt; WantedConstraints
-&gt; TcM ([TcId], [TcId], TcEvBinds, WantedConstraints, Bool)
</span><a href="GHC.Tc.Solver.html#simplifyInfer"><span class="hs-identifier hs-var">simplifyInfer</span></a></span><span> </span><span class="annot"><span class="annottext">TcLevel
</span><a href="#local-6989586621681098097"><span class="hs-identifier hs-var">tclvl</span></a></span><span> </span><span class="annot"><span class="annottext">InferMode
</span><a href="#local-6989586621681098086"><span class="hs-identifier hs-var">infer_mode</span></a></span><span> </span><span class="annot"><span class="annottext">[TcIdSigInst]
</span><a href="#local-6989586621681098089"><span class="hs-identifier hs-var">sigs</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, Kind)]
</span><a href="#local-6989586621681098091"><span class="hs-identifier hs-var">name_taus</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621681098096"><span class="hs-identifier hs-var">wanted</span></a></span><span>
</span><span id="line-822"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">WantedConstraints -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#emitConstraints"><span class="hs-identifier hs-var">emitConstraints</span></a></span><span> </span><span class="annot"><span class="annottext">WantedConstraints
</span><a href="#local-6989586621681098078"><span class="hs-identifier hs-var">residual</span></a></span><span>
</span><span id="line-823"></span><span>
</span><span id="line-824"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098074"><span class="annot"><span class="annottext">inferred_theta :: TcThetaType
</span><a href="#local-6989586621681098074"><span class="hs-identifier hs-var hs-var">inferred_theta</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(TcId -&gt; Kind) -&gt; [TcId] -&gt; TcThetaType
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Tc.Utils.TcType.html#evVarPred"><span class="hs-identifier hs-var">evVarPred</span></a></span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098080"><span class="hs-identifier hs-var">givens</span></a></span><span>
</span><span id="line-825"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098072"><span class="annot"><span class="annottext">[ABExport (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681098072"><span class="hs-identifier hs-var">exports</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM [ABExport (GhcPass 'Typechecked)]
-&gt; TcM [ABExport (GhcPass 'Typechecked)]
forall r. TcM r -&gt; TcM r
</span><a href="GHC.Tc.Utils.Monad.html#checkNoErrs"><span class="hs-identifier hs-var">checkNoErrs</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM [ABExport (GhcPass 'Typechecked)]
 -&gt; TcM [ABExport (GhcPass 'Typechecked)])
-&gt; TcM [ABExport (GhcPass 'Typechecked)]
-&gt; TcM [ABExport (GhcPass 'Typechecked)]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-826"></span><span>                    </span><span class="annot"><span class="annottext">(MonoBindInfo
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (ABExport (GhcPass 'Typechecked)))
-&gt; [MonoBindInfo] -&gt; TcM [ABExport (GhcPass 'Typechecked)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcPragEnv
-&gt; Bool
-&gt; [TcId]
-&gt; TcThetaType
-&gt; MonoBindInfo
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (ABExport (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Gen.Bind.html#mkExport"><span class="hs-identifier hs-var">mkExport</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098101"><span class="hs-identifier hs-var">prag_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681098077"><span class="hs-identifier hs-var">insoluble</span></a></span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098081"><span class="hs-identifier hs-var">qtvs</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681098074"><span class="hs-identifier hs-var">inferred_theta</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681098094"><span class="hs-identifier hs-var">mono_infos</span></a></span><span>
</span><span id="line-827"></span><span>
</span><span id="line-828"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098069"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098069"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcRn SrcSpan
</span><a href="GHC.Tc.Utils.Monad.html#getSrcSpanM"><span class="hs-identifier hs-var">getSrcSpanM</span></a></span><span>
</span><span id="line-829"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098067"><span class="annot"><span class="annottext">poly_ids :: [TcId]
</span><a href="#local-6989586621681098067"><span class="hs-identifier hs-var hs-var">poly_ids</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(ABExport (GhcPass 'Typechecked) -&gt; TcId)
-&gt; [ABExport (GhcPass 'Typechecked)] -&gt; [TcId]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">ABExport (GhcPass 'Typechecked) -&gt; TcId
forall p. ABExport p -&gt; IdP p
</span><a href="GHC.Hs.Binds.html#abe_poly"><span class="hs-identifier hs-var hs-var">abe_poly</span></a></span><span> </span><span class="annot"><span class="annottext">[ABExport (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681098072"><span class="hs-identifier hs-var">exports</span></a></span><span>
</span><span id="line-830"></span><span>             </span><span id="local-6989586621681098066"><span class="annot"><span class="annottext">abs_bind :: GenLocated
  SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
</span><a href="#local-6989586621681098066"><span class="hs-identifier hs-var hs-var">abs_bind</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; GenLocated
     SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681098069"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
 -&gt; GenLocated
      SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)))
-&gt; HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; GenLocated
     SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-831"></span><span>                        </span><span class="annot"><span class="annottext">AbsBinds :: forall idL idR.
XAbsBinds idL idR
-&gt; [TcId]
-&gt; [TcId]
-&gt; [ABExport idL]
-&gt; [TcEvBinds]
-&gt; LHsBinds idL
-&gt; Bool
-&gt; HsBindLR idL idR
</span><a href="GHC.Hs.Binds.html#AbsBinds"><span class="hs-identifier hs-type">AbsBinds</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">abs_ext :: XAbsBinds (GhcPass 'Typechecked) (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#abs_ext"><span class="hs-identifier hs-var">abs_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NoExtField
XAbsBinds (GhcPass 'Typechecked) (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span>
</span><span id="line-832"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abs_tvs :: [TcId]
</span><a href="GHC.Hs.Binds.html#abs_tvs"><span class="hs-identifier hs-var">abs_tvs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098081"><span class="hs-identifier hs-var">qtvs</span></a></span><span>
</span><span id="line-833"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abs_ev_vars :: [TcId]
</span><a href="GHC.Hs.Binds.html#abs_ev_vars"><span class="hs-identifier hs-var">abs_ev_vars</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098080"><span class="hs-identifier hs-var">givens</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abs_ev_binds :: [TcEvBinds]
</span><a href="GHC.Hs.Binds.html#abs_ev_binds"><span class="hs-identifier hs-var">abs_ev_binds</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">TcEvBinds
</span><a href="#local-6989586621681098079"><span class="hs-identifier hs-var">ev_binds</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-834"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abs_exports :: [ABExport (GhcPass 'Typechecked)]
</span><a href="GHC.Hs.Binds.html#abs_exports"><span class="hs-identifier hs-var">abs_exports</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[ABExport (GhcPass 'Typechecked)]
</span><a href="#local-6989586621681098072"><span class="hs-identifier hs-var">exports</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abs_binds :: LHsBinds (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#abs_binds"><span class="hs-identifier hs-var">abs_binds</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098095"><span class="hs-identifier hs-var">binds'</span></a></span><span>
</span><span id="line-835"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abs_sig :: Bool
</span><a href="GHC.Hs.Binds.html#abs_sig"><span class="hs-identifier hs-var">abs_sig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-836"></span><span>
</span><span id="line-837"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Binding:&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(TcId, Kind)] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098067"><span class="hs-identifier hs-var">poly_ids</span></a></span><span> </span><span class="annot"><span class="annottext">[TcId] -&gt; TcThetaType -&gt; [(TcId, Kind)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-operator hs-var">`zip`</span></a></span><span> </span><span class="annot"><span class="annottext">(TcId -&gt; Kind) -&gt; [TcId] -&gt; TcThetaType
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098067"><span class="hs-identifier hs-var">poly_ids</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-838"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Typechecked), [TcId])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [TcId])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated
  SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
-&gt; LHsBinds (GhcPass 'Typechecked)
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="annot"><span class="annottext">GenLocated
  SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
</span><a href="#local-6989586621681098066"><span class="hs-identifier hs-var">abs_bind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098067"><span class="hs-identifier hs-var">poly_ids</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-839"></span><span>         </span><span class="hs-comment">-- poly_ids are guaranteed zonked by mkExport</span><span>
</span><span id="line-840"></span><span>
</span><span id="line-841"></span><span class="hs-comment">--------------</span><span>
</span><span id="line-842"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#mkExport"><span class="hs-identifier hs-type">mkExport</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Sig.html#TcPragEnv"><span class="hs-identifier hs-type">TcPragEnv</span></a></span><span>
</span><span id="line-843"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>                        </span><span class="hs-comment">-- True &lt;=&gt; there was an insoluble type error</span><span>
</span><span id="line-844"></span><span>                                        </span><span class="hs-comment">--          when typechecking the bindings</span><span>
</span><span id="line-845"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-type">TcThetaType</span></a></span><span>      </span><span class="hs-comment">-- Both already zonked</span><span>
</span><span id="line-846"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MonoBindInfo"><span class="hs-identifier hs-type">MonoBindInfo</span></a></span><span>
</span><span id="line-847"></span><span>         </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#ABExport"><span class="hs-identifier hs-type">ABExport</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-848"></span><span class="hs-comment">-- Only called for generalisation plan InferGen, not by CheckGen or NoGen</span><span>
</span><span id="line-849"></span><span class="hs-comment">--</span><span>
</span><span id="line-850"></span><span class="hs-comment">-- mkExport generates exports with</span><span>
</span><span id="line-851"></span><span class="hs-comment">--      zonked type variables,</span><span>
</span><span id="line-852"></span><span class="hs-comment">--      zonked poly_ids</span><span>
</span><span id="line-853"></span><span class="hs-comment">-- The former is just because no further unifications will change</span><span>
</span><span id="line-854"></span><span class="hs-comment">-- the quantified type variables, so we can fix their final form</span><span>
</span><span id="line-855"></span><span class="hs-comment">-- right now.</span><span>
</span><span id="line-856"></span><span class="hs-comment">-- The latter is needed because the poly_ids are used to extend the</span><span>
</span><span id="line-857"></span><span class="hs-comment">-- type environment; see the invariant on GHC.Tc.Utils.Env.tcExtendIdEnv</span><span>
</span><span id="line-858"></span><span>
</span><span id="line-859"></span><span class="hs-comment">-- Pre-condition: the qtvs and theta are already zonked</span><span>
</span><span id="line-860"></span><span>
</span><span id="line-861"></span><span id="mkExport"><span class="annot"><span class="annottext">mkExport :: TcPragEnv
-&gt; Bool
-&gt; [TcId]
-&gt; TcThetaType
-&gt; MonoBindInfo
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (ABExport (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Gen.Bind.html#mkExport"><span class="hs-identifier hs-var hs-var">mkExport</span></a></span></span><span> </span><span id="local-6989586621681098064"><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098064"><span class="hs-identifier hs-var">prag_fn</span></a></span></span><span> </span><span id="local-6989586621681098063"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681098063"><span class="hs-identifier hs-var">insoluble</span></a></span></span><span> </span><span id="local-6989586621681098062"><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098062"><span class="hs-identifier hs-var">qtvs</span></a></span></span><span> </span><span id="local-6989586621681098061"><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681098061"><span class="hs-identifier hs-var">theta</span></a></span></span><span>
</span><span id="line-862"></span><span>         </span><span id="local-6989586621681098060"><span class="annot"><span class="annottext">mono_info :: MonoBindInfo
</span><a href="#local-6989586621681098060"><span class="hs-identifier hs-var">mono_info</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MBI"><span class="hs-identifier hs-type">MBI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mbi_poly_name :: MonoBindInfo -&gt; Name
</span><a href="GHC.Tc.Gen.Bind.html#mbi_poly_name"><span class="hs-identifier hs-var">mbi_poly_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681098059"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098059"><span class="hs-identifier hs-var">poly_name</span></a></span></span><span>
</span><span id="line-863"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_sig :: MonoBindInfo -&gt; Maybe TcIdSigInst
</span><a href="GHC.Tc.Gen.Bind.html#mbi_sig"><span class="hs-identifier hs-var">mbi_sig</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681098058"><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681098058"><span class="hs-identifier hs-var">mb_sig</span></a></span></span><span>
</span><span id="line-864"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_mono_id :: MonoBindInfo -&gt; TcId
</span><a href="GHC.Tc.Gen.Bind.html#mbi_mono_id"><span class="hs-identifier hs-var">mbi_mono_id</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681098057"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098057"><span class="hs-identifier hs-var">mono_id</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-865"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681098056"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098056"><span class="hs-identifier hs-var">mono_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; TcM Kind
</span><a href="GHC.Tc.Utils.TcMType.html#zonkTcType"><span class="hs-identifier hs-var">zonkTcType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098057"><span class="hs-identifier hs-var">mono_id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-866"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098054"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098054"><span class="hs-identifier hs-var">poly_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Bool
-&gt; [TcId]
-&gt; TcThetaType
-&gt; Name
-&gt; Maybe TcIdSigInst
-&gt; Kind
-&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="GHC.Tc.Gen.Bind.html#mkInferredPolyId"><span class="hs-identifier hs-var">mkInferredPolyId</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681098063"><span class="hs-identifier hs-var">insoluble</span></a></span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098062"><span class="hs-identifier hs-var">qtvs</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681098061"><span class="hs-identifier hs-var">theta</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098059"><span class="hs-identifier hs-var">poly_name</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681098058"><span class="hs-identifier hs-var">mb_sig</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098056"><span class="hs-identifier hs-var">mono_ty</span></a></span><span>
</span><span id="line-867"></span><span>
</span><span id="line-868"></span><span>        </span><span class="hs-comment">-- NB: poly_id has a zonked type</span><span>
</span><span id="line-869"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098052"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098052"><span class="hs-identifier hs-var">poly_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcId
-&gt; [LSig (GhcPass 'Renamed)] -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="GHC.Tc.Gen.Sig.html#addInlinePrags"><span class="hs-identifier hs-var">addInlinePrags</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098054"><span class="hs-identifier hs-var">poly_id</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098051"><span class="hs-identifier hs-var">prag_sigs</span></a></span><span>
</span><span id="line-870"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098050"><span class="annot"><span class="annottext">[LTcSpecPrag]
</span><a href="#local-6989586621681098050"><span class="hs-identifier hs-var">spec_prags</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcId -&gt; [LSig (GhcPass 'Renamed)] -&gt; TcM [LTcSpecPrag]
</span><a href="GHC.Tc.Gen.Sig.html#tcSpecPrags"><span class="hs-identifier hs-var">tcSpecPrags</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098052"><span class="hs-identifier hs-var">poly_id</span></a></span><span> </span><span class="annot"><span class="annottext">[LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098051"><span class="hs-identifier hs-var">prag_sigs</span></a></span><span>
</span><span id="line-871"></span><span>                </span><span class="hs-comment">-- tcPrags requires a zonked poly_id</span><span>
</span><span id="line-872"></span><span>
</span><span id="line-873"></span><span>        </span><span class="hs-comment">-- See Note [Impedance matching]</span><span>
</span><span id="line-874"></span><span>        </span><span class="hs-comment">-- NB: we have already done checkValidType, including an ambiguity check,</span><span>
</span><span id="line-875"></span><span>        </span><span class="hs-comment">--     on the type; either when we checked the sig or in mkInferredPolyId</span><span>
</span><span id="line-876"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098049"><span class="annot"><span class="annottext">poly_ty :: Kind
</span><a href="#local-6989586621681098049"><span class="hs-identifier hs-var hs-var">poly_ty</span></a></span></span><span>     </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098052"><span class="hs-identifier hs-var">poly_id</span></a></span><span>
</span><span id="line-877"></span><span>              </span><span id="local-6989586621681098048"><span class="annot"><span class="annottext">sel_poly_ty :: Kind
</span><a href="#local-6989586621681098048"><span class="hs-identifier hs-var hs-var">sel_poly_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TcId] -&gt; TcThetaType -&gt; Kind -&gt; Kind
</span><a href="GHC.Tc.Utils.TcType.html#mkInfSigmaTy"><span class="hs-identifier hs-var">mkInfSigmaTy</span></a></span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098062"><span class="hs-identifier hs-var">qtvs</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681098061"><span class="hs-identifier hs-var">theta</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098056"><span class="hs-identifier hs-var">mono_ty</span></a></span><span>
</span><span id="line-878"></span><span>                </span><span class="hs-comment">-- This type is just going into tcSubType,</span><span>
</span><span id="line-879"></span><span>                </span><span class="hs-comment">-- so Inferred vs. Specified doesn't matter</span><span>
</span><span id="line-880"></span><span>
</span><span id="line-881"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098046"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681098046"><span class="hs-identifier hs-var">wrap</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098048"><span class="hs-identifier hs-var">sel_poly_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; Kind -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098049"><span class="hs-identifier hs-var">poly_ty</span></a></span><span>  </span><span class="hs-comment">-- NB: eqType ignores visibility</span><span>
</span><span id="line-882"></span><span>                  </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">HsWrapper -&gt; IOEnv (Env TcGblEnv TcLclEnv) HsWrapper
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="GHC.Tc.Types.Evidence.html#idHsWrapper"><span class="hs-identifier hs-var">idHsWrapper</span></a></span><span>  </span><span class="hs-comment">-- Fast path; also avoids complaint when we infer</span><span>
</span><span id="line-883"></span><span>                                           </span><span class="hs-comment">-- an ambiguous type and have AllowAmbiguousType</span><span>
</span><span id="line-884"></span><span>                                           </span><span class="hs-comment">-- e..g infer  x :: forall a. F a -&gt; Int</span><span>
</span><span id="line-885"></span><span>                  </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">(TidyEnv -&gt; TcM (TidyEnv, SDoc))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) HsWrapper
-&gt; IOEnv (Env TcGblEnv TcLclEnv) HsWrapper
forall a. (TidyEnv -&gt; TcM (TidyEnv, SDoc)) -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#addErrCtxtM"><span class="hs-identifier hs-var">addErrCtxtM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MonoBindInfo -&gt; Kind -&gt; Kind -&gt; TidyEnv -&gt; TcM (TidyEnv, SDoc)
</span><a href="GHC.Tc.Gen.Bind.html#mk_impedance_match_msg"><span class="hs-identifier hs-var">mk_impedance_match_msg</span></a></span><span> </span><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681098060"><span class="hs-identifier hs-var">mono_info</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098048"><span class="hs-identifier hs-var">sel_poly_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098049"><span class="hs-identifier hs-var">poly_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) HsWrapper
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) HsWrapper)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) HsWrapper
-&gt; IOEnv (Env TcGblEnv TcLclEnv) HsWrapper
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-886"></span><span>                       </span><span class="annot"><span class="annottext">UserTypeCtxt
-&gt; Kind -&gt; Kind -&gt; IOEnv (Env TcGblEnv TcLclEnv) HsWrapper
</span><a href="GHC.Tc.Utils.Unify.html#tcSubTypeSigma"><span class="hs-identifier hs-var">tcSubTypeSigma</span></a></span><span> </span><span class="annot"><span class="annottext">UserTypeCtxt
</span><a href="#local-6989586621681098041"><span class="hs-identifier hs-var">sig_ctxt</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098048"><span class="hs-identifier hs-var">sel_poly_ty</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098049"><span class="hs-identifier hs-var">poly_ty</span></a></span><span>
</span><span id="line-887"></span><span>
</span><span id="line-888"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681098040"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681098040"><span class="hs-identifier hs-var">warn_missing_sigs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; TcRnIf TcGblEnv TcLclEnv Bool
forall gbl lcl. WarningFlag -&gt; TcRnIf gbl lcl Bool
</span><a href="GHC.Tc.Utils.Monad.html#woptM"><span class="hs-identifier hs-var">woptM</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissingLocalSignatures"><span class="hs-identifier hs-var">Opt_WarnMissingLocalSignatures</span></a></span><span>
</span><span id="line-889"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; TcRn () -&gt; TcRn ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681098040"><span class="hs-identifier hs-var">warn_missing_sigs</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; TcRn ()) -&gt; TcRn () -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-890"></span><span>              </span><span class="annot"><span class="annottext">WarningFlag -&gt; TcId -&gt; Maybe TcIdSigInst -&gt; TcRn ()
</span><a href="GHC.Tc.Gen.Bind.html#localSigWarn"><span class="hs-identifier hs-var">localSigWarn</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="GHC.Driver.Flags.html#Opt_WarnMissingLocalSignatures"><span class="hs-identifier hs-var">Opt_WarnMissingLocalSignatures</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098052"><span class="hs-identifier hs-var">poly_id</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681098058"><span class="hs-identifier hs-var">mb_sig</span></a></span><span>
</span><span id="line-891"></span><span>
</span><span id="line-892"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">ABExport (GhcPass 'Typechecked)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (ABExport (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ABE :: forall p.
XABE p -&gt; IdP p -&gt; IdP p -&gt; HsWrapper -&gt; TcSpecPrags -&gt; ABExport p
</span><a href="GHC.Hs.Binds.html#ABE"><span class="hs-identifier hs-type">ABE</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">abe_ext :: XABE (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#abe_ext"><span class="hs-identifier hs-var">abe_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NoExtField
XABE (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span>
</span><span id="line-893"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abe_wrap :: HsWrapper
</span><a href="GHC.Hs.Binds.html#abe_wrap"><span class="hs-identifier hs-var">abe_wrap</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681098046"><span class="hs-identifier hs-var">wrap</span></a></span><span>
</span><span id="line-894"></span><span>                        </span><span class="hs-comment">-- abe_wrap :: idType poly_id ~ (forall qtvs. theta =&gt; mono_ty)</span><span>
</span><span id="line-895"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abe_poly :: IdP (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#abe_poly"><span class="hs-identifier hs-var">abe_poly</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcId
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098052"><span class="hs-identifier hs-var">poly_id</span></a></span><span>
</span><span id="line-896"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abe_mono :: IdP (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#abe_mono"><span class="hs-identifier hs-var">abe_mono</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcId
IdP (GhcPass 'Typechecked)
</span><a href="#local-6989586621681098057"><span class="hs-identifier hs-var">mono_id</span></a></span><span>
</span><span id="line-897"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">abe_prags :: TcSpecPrags
</span><a href="GHC.Hs.Binds.html#abe_prags"><span class="hs-identifier hs-var">abe_prags</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LTcSpecPrag] -&gt; TcSpecPrags
</span><a href="GHC.Hs.Binds.html#SpecPrags"><span class="hs-identifier hs-var">SpecPrags</span></a></span><span> </span><span class="annot"><span class="annottext">[LTcSpecPrag]
</span><a href="#local-6989586621681098050"><span class="hs-identifier hs-var">spec_prags</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-898"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-899"></span><span>    </span><span id="local-6989586621681098051"><span class="annot"><span class="annottext">prag_sigs :: [LSig (GhcPass 'Renamed)]
</span><a href="#local-6989586621681098051"><span class="hs-identifier hs-var hs-var">prag_sigs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcPragEnv -&gt; Name -&gt; [LSig (GhcPass 'Renamed)]
</span><a href="GHC.Tc.Gen.Sig.html#lookupPragEnv"><span class="hs-identifier hs-var">lookupPragEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681098064"><span class="hs-identifier hs-var">prag_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098059"><span class="hs-identifier hs-var">poly_name</span></a></span><span>
</span><span id="line-900"></span><span>    </span><span id="local-6989586621681098041"><span class="annot"><span class="annottext">sig_ctxt :: UserTypeCtxt
</span><a href="#local-6989586621681098041"><span class="hs-identifier hs-var hs-var">sig_ctxt</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; UserTypeCtxt
</span><a href="GHC.Tc.Types.Origin.html#InfSigCtxt"><span class="hs-identifier hs-var">InfSigCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098059"><span class="hs-identifier hs-var">poly_name</span></a></span><span>
</span><span id="line-901"></span><span>
</span><span id="line-902"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#mkInferredPolyId"><span class="hs-identifier hs-type">mkInferredPolyId</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>  </span><span class="hs-comment">-- True &lt;=&gt; there was an insoluble error when</span><span>
</span><span id="line-903"></span><span>                          </span><span class="hs-comment">--          checking the binding group for this Id</span><span>
</span><span id="line-904"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TyVar"><span class="hs-identifier hs-type">TyVar</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-type">TcThetaType</span></a></span><span>
</span><span id="line-905"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInst"><span class="hs-identifier hs-type">TcIdSigInst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span>
</span><span id="line-906"></span><span>                 </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span>
</span><span id="line-907"></span><span id="mkInferredPolyId"><span class="annot"><span class="annottext">mkInferredPolyId :: Bool
-&gt; [TcId]
-&gt; TcThetaType
-&gt; Name
-&gt; Maybe TcIdSigInst
-&gt; Kind
-&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="GHC.Tc.Gen.Bind.html#mkInferredPolyId"><span class="hs-identifier hs-var hs-var">mkInferredPolyId</span></a></span></span><span> </span><span id="local-6989586621681098034"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681098034"><span class="hs-identifier hs-var">insoluble</span></a></span></span><span> </span><span id="local-6989586621681098033"><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098033"><span class="hs-identifier hs-var">qtvs</span></a></span></span><span> </span><span id="local-6989586621681098032"><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681098032"><span class="hs-identifier hs-var">inferred_theta</span></a></span></span><span> </span><span id="local-6989586621681098031"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098031"><span class="hs-identifier hs-var">poly_name</span></a></span></span><span> </span><span id="local-6989586621681098030"><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681098030"><span class="hs-identifier hs-var">mb_sig_inst</span></a></span></span><span> </span><span id="local-6989586621681098029"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098029"><span class="hs-identifier hs-var">mono_ty</span></a></span></span><span>
</span><span id="line-908"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TISI"><span class="hs-identifier hs-type">TISI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sig_inst_sig :: TcIdSigInst -&gt; TcIdSigInfo
</span><a href="GHC.Tc.Types.html#sig_inst_sig"><span class="hs-identifier hs-var">sig_inst_sig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681098026"><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681098026"><span class="hs-identifier hs-var">sig</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681098030"><span class="hs-identifier hs-var">mb_sig_inst</span></a></span><span>
</span><span id="line-909"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#CompleteSig"><span class="hs-identifier hs-type">CompleteSig</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sig_bndr :: TcIdSigInfo -&gt; TcId
</span><a href="GHC.Tc.Types.html#sig_bndr"><span class="hs-identifier hs-var">sig_bndr</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681098025"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098025"><span class="hs-identifier hs-var">poly_id</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681098026"><span class="hs-identifier hs-var">sig</span></a></span><span>
</span><span id="line-910"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcId -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098025"><span class="hs-identifier hs-var">poly_id</span></a></span><span>
</span><span id="line-911"></span><span>
</span><span id="line-912"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-comment">-- Either no type sig or partial type sig</span><span>
</span><span id="line-913"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IOEnv (Env TcGblEnv TcLclEnv) TcId
-&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
forall r. TcM r -&gt; TcM r
</span><a href="GHC.Tc.Utils.Monad.html#checkNoErrs"><span class="hs-identifier hs-var">checkNoErrs</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) TcId
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
-&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>  </span><span class="hs-comment">-- The checkNoErrs ensures that if the type is ambiguous</span><span>
</span><span id="line-914"></span><span>                   </span><span class="hs-comment">-- we don't carry on to the impedance matching, and generate</span><span>
</span><span id="line-915"></span><span>                   </span><span class="hs-comment">-- a duplicate ambiguity error.  There is a similar</span><span>
</span><span id="line-916"></span><span>                   </span><span class="hs-comment">-- checkNoErrs for complete type signatures too.</span><span>
</span><span id="line-917"></span><span>    </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681098024"><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681098024"><span class="hs-identifier hs-var">fam_envs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM FamInstEnvs
</span><a href="GHC.Tc.Instance.Family.html#tcGetFamInstEnvs"><span class="hs-identifier hs-var">tcGetFamInstEnvs</span></a></span><span>
</span><span id="line-918"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098023"><span class="annot"><span class="annottext">TcCoercionR
</span><a href="#local-6989586621681098023"><span class="hs-identifier hs-var">_co</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098022"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098022"><span class="hs-identifier hs-var">mono_ty'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FamInstEnvs -&gt; Role -&gt; Kind -&gt; (TcCoercionR, Kind)
</span><a href="GHC.Core.FamInstEnv.html#normaliseType"><span class="hs-identifier hs-var">normaliseType</span></a></span><span> </span><span class="annot"><span class="annottext">FamInstEnvs
</span><a href="#local-6989586621681098024"><span class="hs-identifier hs-var">fam_envs</span></a></span><span> </span><span class="annot"><span class="annottext">Role
</span><a href="GHC.Core.Coercion.Axiom.html#Nominal"><span class="hs-identifier hs-var">Nominal</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098029"><span class="hs-identifier hs-var">mono_ty</span></a></span><span>
</span><span id="line-919"></span><span>               </span><span class="hs-comment">-- Unification may not have normalised the type,</span><span>
</span><span id="line-920"></span><span>               </span><span class="hs-comment">-- (see Note [Lazy flattening] in GHC.Tc.Solver.Flatten) so do it</span><span>
</span><span id="line-921"></span><span>               </span><span class="hs-comment">-- here to make it as uncomplicated as possible.</span><span>
</span><span id="line-922"></span><span>               </span><span class="hs-comment">-- Example: f :: [F Int] -&gt; Bool</span><span>
</span><span id="line-923"></span><span>               </span><span class="hs-comment">-- should be rewritten to f :: [Char] -&gt; Bool, if possible</span><span>
</span><span id="line-924"></span><span>               </span><span class="hs-comment">--</span><span>
</span><span id="line-925"></span><span>               </span><span class="hs-comment">-- We can discard the coercion _co, because we'll reconstruct</span><span>
</span><span id="line-926"></span><span>               </span><span class="hs-comment">-- it in the call to tcSubType below</span><span>
</span><span id="line-927"></span><span>
</span><span id="line-928"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681098020"><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681098020"><span class="hs-identifier hs-var">binders</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681098019"><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681098019"><span class="hs-identifier hs-var">theta'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcThetaType
-&gt; TcTyVarSet
-&gt; [TcId]
-&gt; Maybe TcIdSigInst
-&gt; TcM ([InvisTVBinder], TcThetaType)
</span><a href="GHC.Tc.Gen.Bind.html#chooseInferredQuantifiers"><span class="hs-identifier hs-var">chooseInferredQuantifiers</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681098032"><span class="hs-identifier hs-var">inferred_theta</span></a></span><span>
</span><span id="line-929"></span><span>                                </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind -&gt; TcTyVarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfType"><span class="hs-identifier hs-var">tyCoVarsOfType</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098022"><span class="hs-identifier hs-var">mono_ty'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098033"><span class="hs-identifier hs-var">qtvs</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681098030"><span class="hs-identifier hs-var">mb_sig_inst</span></a></span><span>
</span><span id="line-930"></span><span>
</span><span id="line-931"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098017"><span class="annot"><span class="annottext">inferred_poly_ty :: Kind
</span><a href="#local-6989586621681098017"><span class="hs-identifier hs-var hs-var">inferred_poly_ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[InvisTVBinder] -&gt; Kind -&gt; Kind
</span><a href="GHC.Core.TyCo.Rep.html#mkInvisForAllTys"><span class="hs-identifier hs-var">mkInvisForAllTys</span></a></span><span> </span><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681098020"><span class="hs-identifier hs-var">binders</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcThetaType -&gt; Kind -&gt; Kind
</span><a href="GHC.Tc.Utils.TcType.html#mkPhiTy"><span class="hs-identifier hs-var">mkPhiTy</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681098019"><span class="hs-identifier hs-var">theta'</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098022"><span class="hs-identifier hs-var">mono_ty'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-932"></span><span>
</span><span id="line-933"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;mkInferredPolyId&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098031"><span class="hs-identifier hs-var">poly_name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[TcId] -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098033"><span class="hs-identifier hs-var">qtvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcThetaType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681098019"><span class="hs-identifier hs-var">theta'</span></a></span><span>
</span><span id="line-934"></span><span>                                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098017"><span class="hs-identifier hs-var">inferred_poly_ty</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-935"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; TcRn () -&gt; TcRn ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/Control.Monad.html#unless"><span class="hs-identifier hs-var">unless</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681098034"><span class="hs-identifier hs-var">insoluble</span></a></span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; TcRn ()) -&gt; TcRn () -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-936"></span><span>         </span><span class="annot"><span class="annottext">(TidyEnv -&gt; TcM (TidyEnv, SDoc)) -&gt; TcRn () -&gt; TcRn ()
forall a. (TidyEnv -&gt; TcM (TidyEnv, SDoc)) -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#addErrCtxtM"><span class="hs-identifier hs-var">addErrCtxtM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; Kind -&gt; TidyEnv -&gt; TcM (TidyEnv, SDoc)
</span><a href="GHC.Tc.Gen.Bind.html#mk_inf_msg"><span class="hs-identifier hs-var">mk_inf_msg</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098031"><span class="hs-identifier hs-var">poly_name</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098017"><span class="hs-identifier hs-var">inferred_poly_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; TcRn ()) -&gt; TcRn () -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-937"></span><span>         </span><span class="annot"><span class="annottext">UserTypeCtxt -&gt; Kind -&gt; TcRn ()
</span><a href="GHC.Tc.Validity.html#checkValidType"><span class="hs-identifier hs-var">checkValidType</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; UserTypeCtxt
</span><a href="GHC.Tc.Types.Origin.html#InfSigCtxt"><span class="hs-identifier hs-var">InfSigCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098031"><span class="hs-identifier hs-var">poly_name</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098017"><span class="hs-identifier hs-var">inferred_poly_ty</span></a></span><span>
</span><span id="line-938"></span><span>         </span><span class="hs-comment">-- See Note [Validity of inferred types]</span><span>
</span><span id="line-939"></span><span>         </span><span class="hs-comment">-- If we found an insoluble error in the function definition, don't</span><span>
</span><span id="line-940"></span><span>         </span><span class="hs-comment">-- do this check; otherwise (#14000) we may report an ambiguity</span><span>
</span><span id="line-941"></span><span>         </span><span class="hs-comment">-- error for a rather bogus type.</span><span>
</span><span id="line-942"></span><span>
</span><span id="line-943"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcId -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HasDebugCallStack =&gt; Name -&gt; Kind -&gt; Kind -&gt; TcId
Name -&gt; Kind -&gt; Kind -&gt; TcId
</span><a href="GHC.Types.Id.html#mkLocalId"><span class="hs-identifier hs-var">mkLocalId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681098031"><span class="hs-identifier hs-var">poly_name</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681098017"><span class="hs-identifier hs-var">inferred_poly_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-944"></span><span>
</span><span id="line-945"></span><span>
</span><span id="line-946"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#chooseInferredQuantifiers"><span class="hs-identifier hs-type">chooseInferredQuantifiers</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-type">TcThetaType</span></a></span><span>   </span><span class="hs-comment">-- inferred</span><span>
</span><span id="line-947"></span><span>                          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcTyVarSet"><span class="hs-identifier hs-type">TcTyVarSet</span></a></span><span>    </span><span class="hs-comment">-- tvs free in tau type</span><span>
</span><span id="line-948"></span><span>                          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#TcTyVar"><span class="hs-identifier hs-type">TcTyVar</span></a></span><span class="hs-special">]</span><span>     </span><span class="hs-comment">-- inferred quantified tvs</span><span>
</span><span id="line-949"></span><span>                          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInst"><span class="hs-identifier hs-type">TcIdSigInst</span></a></span><span>
</span><span id="line-950"></span><span>                          </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.Var.html#InvisTVBinder"><span class="hs-identifier hs-type">InvisTVBinder</span></a></span><span class="hs-special">]</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-type">TcThetaType</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-951"></span><span id="chooseInferredQuantifiers"><span class="annot"><span class="annottext">chooseInferredQuantifiers :: TcThetaType
-&gt; TcTyVarSet
-&gt; [TcId]
-&gt; Maybe TcIdSigInst
-&gt; TcM ([InvisTVBinder], TcThetaType)
</span><a href="GHC.Tc.Gen.Bind.html#chooseInferredQuantifiers"><span class="hs-identifier hs-var hs-var">chooseInferredQuantifiers</span></a></span></span><span> </span><span id="local-6989586621681098011"><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681098011"><span class="hs-identifier hs-var">inferred_theta</span></a></span></span><span> </span><span id="local-6989586621681098010"><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681098010"><span class="hs-identifier hs-var">tau_tvs</span></a></span></span><span> </span><span id="local-6989586621681098009"><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098009"><span class="hs-identifier hs-var">qtvs</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-952"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- No type signature (partial or complete) for this binder,</span><span>
</span><span id="line-953"></span><span>    </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681098008"><span class="annot"><span class="annottext">free_tvs :: TcTyVarSet
</span><a href="#local-6989586621681098008"><span class="hs-identifier hs-var hs-var">free_tvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVarSet -&gt; TcTyVarSet
</span><a href="GHC.Core.TyCo.FVs.html#closeOverKinds"><span class="hs-identifier hs-var">closeOverKinds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcThetaType -&gt; TcTyVarSet -&gt; TcTyVarSet
</span><a href="GHC.Tc.Solver.html#growThetaTyVars"><span class="hs-identifier hs-var">growThetaTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681098011"><span class="hs-identifier hs-var">inferred_theta</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681098010"><span class="hs-identifier hs-var">tau_tvs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-954"></span><span>                        </span><span class="hs-comment">-- Include kind variables!  #7916</span><span>
</span><span id="line-955"></span><span>             </span><span id="local-6989586621681098005"><span class="annot"><span class="annottext">my_theta :: TcThetaType
</span><a href="#local-6989586621681098005"><span class="hs-identifier hs-var hs-var">my_theta</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVarSet -&gt; TcThetaType -&gt; TcThetaType
</span><a href="GHC.Tc.Utils.TcType.html#pickCapturedPreds"><span class="hs-identifier hs-var">pickCapturedPreds</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681098008"><span class="hs-identifier hs-var">free_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681098011"><span class="hs-identifier hs-var">inferred_theta</span></a></span><span>
</span><span id="line-956"></span><span>             </span><span id="local-6989586621681098003"><span class="annot"><span class="annottext">binders :: [InvisTVBinder]
</span><a href="#local-6989586621681098003"><span class="hs-identifier hs-var hs-var">binders</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Specificity -&gt; TcId -&gt; InvisTVBinder
forall vis. vis -&gt; TcId -&gt; VarBndr TcId vis
</span><a href="GHC.Types.Var.html#mkTyVarBinder"><span class="hs-identifier hs-var">mkTyVarBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Specificity
</span><a href="GHC.Types.Var.html#InferredSpec"><span class="hs-identifier hs-var">InferredSpec</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098000"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-957"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681098000"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098000"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681098009"><span class="hs-identifier hs-var">qtvs</span></a></span><span>
</span><span id="line-958"></span><span>                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681098000"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="annot"><span class="annottext">TcId -&gt; TcTyVarSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#elemVarSet"><span class="hs-operator hs-var">`elemVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681098008"><span class="hs-identifier hs-var">free_tvs</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-959"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([InvisTVBinder], TcThetaType)
-&gt; TcM ([InvisTVBinder], TcThetaType)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681098003"><span class="hs-identifier hs-var">binders</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681098005"><span class="hs-identifier hs-var">my_theta</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-960"></span><span>
</span><span id="line-961"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#chooseInferredQuantifiers"><span class="hs-identifier hs-var">chooseInferredQuantifiers</span></a></span><span> </span><span id="local-6989586621681097998"><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097998"><span class="hs-identifier hs-var">inferred_theta</span></a></span></span><span> </span><span id="local-6989586621681097997"><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097997"><span class="hs-identifier hs-var">tau_tvs</span></a></span></span><span> </span><span id="local-6989586621681097996"><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681097996"><span class="hs-identifier hs-var">qtvs</span></a></span></span><span>
</span><span id="line-962"></span><span>                          </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TISI"><span class="hs-identifier hs-type">TISI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sig_inst_sig :: TcIdSigInst -&gt; TcIdSigInfo
</span><a href="GHC.Tc.Types.html#sig_inst_sig"><span class="hs-identifier hs-var">sig_inst_sig</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097995"><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097995"><span class="hs-identifier hs-var">sig</span></a></span></span><span>  </span><span class="hs-comment">-- Always PartialSig</span><span>
</span><span id="line-963"></span><span>                                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">sig_inst_wcx :: TcIdSigInst -&gt; Maybe Kind
</span><a href="GHC.Tc.Types.html#sig_inst_wcx"><span class="hs-identifier hs-var">sig_inst_wcx</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097993"><span class="annot"><span class="annottext">Maybe Kind
</span><a href="#local-6989586621681097993"><span class="hs-identifier hs-var">wcx</span></a></span></span><span>
</span><span id="line-964"></span><span>                                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">sig_inst_theta :: TcIdSigInst -&gt; TcThetaType
</span><a href="GHC.Tc.Types.html#sig_inst_theta"><span class="hs-identifier hs-var">sig_inst_theta</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097991"><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097991"><span class="hs-identifier hs-var">annotated_theta</span></a></span></span><span>
</span><span id="line-965"></span><span>                                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">sig_inst_skols :: TcIdSigInst -&gt; [(Name, InvisTVBinder)]
</span><a href="GHC.Tc.Types.html#sig_inst_skols"><span class="hs-identifier hs-var">sig_inst_skols</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097989"><span class="annot"><span class="annottext">[(Name, InvisTVBinder)]
</span><a href="#local-6989586621681097989"><span class="hs-identifier hs-var">annotated_tvs</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-966"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- Choose quantifiers for a partial type signature</span><span>
</span><span id="line-967"></span><span>    </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681097988"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681097988"><span class="hs-identifier hs-var">psig_qtv_nms</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097987"><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681097987"><span class="hs-identifier hs-var">psig_qtv_bndrs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Name, InvisTVBinder)] -&gt; ([Name], [InvisTVBinder])
forall a b. [(a, b)] -&gt; ([a], [b])
</span><a href="../../base/src/GHC.List.html#unzip"><span class="hs-identifier hs-var">unzip</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, InvisTVBinder)]
</span><a href="#local-6989586621681097989"><span class="hs-identifier hs-var">annotated_tvs</span></a></span><span>
</span><span id="line-968"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681097985"><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681097985"><span class="hs-identifier hs-var">psig_qtv_bndrs</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(InvisTVBinder -&gt; IOEnv (Env TcGblEnv TcLclEnv) InvisTVBinder)
-&gt; [InvisTVBinder] -&gt; IOEnv (Env TcGblEnv TcLclEnv) [InvisTVBinder]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">InvisTVBinder -&gt; IOEnv (Env TcGblEnv TcLclEnv) InvisTVBinder
forall spec. VarBndr TcId spec -&gt; TcM (VarBndr TcId spec)
</span><a href="GHC.Tc.Utils.TcMType.html#zonkInvisTVBinder"><span class="hs-identifier hs-var">zonkInvisTVBinder</span></a></span><span> </span><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681097987"><span class="hs-identifier hs-var">psig_qtv_bndrs</span></a></span><span>
</span><span id="line-969"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097983"><span class="annot"><span class="annottext">psig_qtvs :: [TcId]
</span><a href="#local-6989586621681097983"><span class="hs-identifier hs-var hs-var">psig_qtvs</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(InvisTVBinder -&gt; TcId) -&gt; [InvisTVBinder] -&gt; [TcId]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">InvisTVBinder -&gt; TcId
forall tv argf. VarBndr tv argf -&gt; tv
</span><a href="GHC.Types.Var.html#binderVar"><span class="hs-identifier hs-var">binderVar</span></a></span><span> </span><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681097985"><span class="hs-identifier hs-var">psig_qtv_bndrs</span></a></span><span>
</span><span id="line-970"></span><span>             </span><span id="local-6989586621681097981"><span class="annot"><span class="annottext">psig_qtv_set :: TcTyVarSet
</span><a href="#local-6989586621681097981"><span class="hs-identifier hs-var hs-var">psig_qtv_set</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TcId] -&gt; TcTyVarSet
</span><a href="GHC.Types.Var.Set.html#mkVarSet"><span class="hs-identifier hs-var">mkVarSet</span></a></span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681097983"><span class="hs-identifier hs-var">psig_qtvs</span></a></span><span>
</span><span id="line-971"></span><span>             </span><span id="local-6989586621681097979"><span class="annot"><span class="annottext">psig_qtv_prs :: [(Name, TcId)]
</span><a href="#local-6989586621681097979"><span class="hs-identifier hs-var hs-var">psig_qtv_prs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681097988"><span class="hs-identifier hs-var">psig_qtv_nms</span></a></span><span> </span><span class="annot"><span class="annottext">[Name] -&gt; [TcId] -&gt; [(Name, TcId)]
forall a b. [a] -&gt; [b] -&gt; [(a, b)]
</span><a href="../../base/src/GHC.List.html#zip"><span class="hs-operator hs-var">`zip`</span></a></span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681097983"><span class="hs-identifier hs-var">psig_qtvs</span></a></span><span>
</span><span id="line-972"></span><span>
</span><span id="line-973"></span><span>
</span><span id="line-974"></span><span>            </span><span class="hs-comment">-- Check whether the quantified variables of the</span><span>
</span><span id="line-975"></span><span>            </span><span class="hs-comment">-- partial signature have been unified together</span><span>
</span><span id="line-976"></span><span>            </span><span class="hs-comment">-- See Note [Quantified variables in partial type signatures]</span><span>
</span><span id="line-977"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">((Name, Name) -&gt; TcRn ()) -&gt; [(Name, Name)] -&gt; TcRn ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">(Name, Name) -&gt; TcRn ()
</span><a href="#local-6989586621681097978"><span class="hs-identifier hs-var">report_dup_tyvar_tv_err</span></a></span><span>  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[(Name, TcId)] -&gt; [(Name, Name)]
</span><a href="GHC.Tc.Utils.TcType.html#findDupTyVarTvs"><span class="hs-identifier hs-var">findDupTyVarTvs</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, TcId)]
</span><a href="#local-6989586621681097979"><span class="hs-identifier hs-var">psig_qtv_prs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-978"></span><span>
</span><span id="line-979"></span><span>            </span><span class="hs-comment">-- Check whether a quantified variable of the partial type</span><span>
</span><span id="line-980"></span><span>            </span><span class="hs-comment">-- signature is not actually quantified.  How can that happen?</span><span>
</span><span id="line-981"></span><span>            </span><span class="hs-comment">-- See Note [Quantification and partial signatures] Wrinkle 4</span><span>
</span><span id="line-982"></span><span>            </span><span class="hs-comment">--     in GHC.Tc.Solver</span><span>
</span><span id="line-983"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; TcRn ()) -&gt; [Name] -&gt; TcRn ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcRn ()
</span><a href="#local-6989586621681097976"><span class="hs-identifier hs-var">report_mono_sig_tv_err</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097975"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681097975"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097975"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681097974"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097974"><span class="hs-identifier hs-var">tv</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Name, TcId)]
</span><a href="#local-6989586621681097979"><span class="hs-identifier hs-var">psig_qtv_prs</span></a></span><span>
</span><span id="line-984"></span><span>                                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097974"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="annot"><span class="annottext">TcId -&gt; [TcId] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681097996"><span class="hs-identifier hs-var">qtvs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-985"></span><span>
</span><span id="line-986"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681097972"><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097972"><span class="hs-identifier hs-var">annotated_theta</span></a></span></span><span>      </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcThetaType -&gt; TcM TcThetaType
</span><a href="GHC.Tc.Utils.TcMType.html#zonkTcTypes"><span class="hs-identifier hs-var">zonkTcTypes</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097991"><span class="hs-identifier hs-var">annotated_theta</span></a></span><span>
</span><span id="line-987"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681097970"><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097970"><span class="hs-identifier hs-var">free_tvs</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097969"><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097969"><span class="hs-identifier hs-var">my_theta</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
-&gt; TcThetaType -&gt; Maybe Kind -&gt; TcM (TcTyVarSet, TcThetaType)
</span><a href="#local-6989586621681097968"><span class="hs-identifier hs-var">choose_psig_context</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097981"><span class="hs-identifier hs-var">psig_qtv_set</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097972"><span class="hs-identifier hs-var">annotated_theta</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe Kind
</span><a href="#local-6989586621681097993"><span class="hs-identifier hs-var">wcx</span></a></span><span>
</span><span id="line-988"></span><span>
</span><span id="line-989"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097967"><span class="annot"><span class="annottext">keep_me :: TcTyVarSet
</span><a href="#local-6989586621681097967"><span class="hs-identifier hs-var hs-var">keep_me</span></a></span></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097970"><span class="hs-identifier hs-var">free_tvs</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet -&gt; TcTyVarSet -&gt; TcTyVarSet
</span><a href="GHC.Types.Var.Set.html#unionVarSet"><span class="hs-operator hs-var">`unionVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097981"><span class="hs-identifier hs-var">psig_qtv_set</span></a></span><span>
</span><span id="line-990"></span><span>             </span><span id="local-6989586621681097965"><span class="annot"><span class="annottext">final_qtvs :: [InvisTVBinder]
</span><a href="#local-6989586621681097965"><span class="hs-identifier hs-var hs-var">final_qtvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Specificity -&gt; TcId -&gt; InvisTVBinder
forall vis. vis -&gt; TcId -&gt; VarBndr TcId vis
</span><a href="GHC.Types.Var.html#mkTyVarBinder"><span class="hs-identifier hs-var">mkTyVarBinder</span></a></span><span> </span><span class="annot"><span class="annottext">Specificity
</span><a href="#local-6989586621681097964"><span class="hs-identifier hs-var">vis</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097963"><span class="hs-identifier hs-var">tv</span></a></span><span>
</span><span id="line-991"></span><span>                          </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681097963"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097963"><span class="hs-identifier hs-var">tv</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[TcId]
</span><a href="#local-6989586621681097996"><span class="hs-identifier hs-var">qtvs</span></a></span><span> </span><span class="hs-comment">-- Pulling from qtvs maintains original order</span><span>
</span><span id="line-992"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097963"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="annot"><span class="annottext">TcId -&gt; TcTyVarSet -&gt; Bool
</span><a href="GHC.Types.Var.Set.html#elemVarSet"><span class="hs-operator hs-var">`elemVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097967"><span class="hs-identifier hs-var">keep_me</span></a></span><span>
</span><span id="line-993"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097964"><span class="annot"><span class="annottext">vis :: Specificity
</span><a href="#local-6989586621681097964"><span class="hs-identifier hs-var hs-var">vis</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcId -&gt; [InvisTVBinder] -&gt; Maybe Specificity
forall var flag. Eq var =&gt; var -&gt; [VarBndr var flag] -&gt; Maybe flag
</span><a href="GHC.Types.Var.html#lookupVarBndr"><span class="hs-identifier hs-var">lookupVarBndr</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097963"><span class="hs-identifier hs-var">tv</span></a></span><span> </span><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681097985"><span class="hs-identifier hs-var">psig_qtv_bndrs</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-994"></span><span>                                  </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681097961"><span class="annot"><span class="annottext">Specificity
</span><a href="#local-6989586621681097961"><span class="hs-identifier hs-var">spec</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Specificity
</span><a href="#local-6989586621681097961"><span class="hs-identifier hs-var">spec</span></a></span><span>
</span><span id="line-995"></span><span>                                  </span><span class="annot"><span class="annottext">Maybe Specificity
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Specificity
</span><a href="GHC.Types.Var.html#InferredSpec"><span class="hs-identifier hs-var">InferredSpec</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-996"></span><span>
</span><span id="line-997"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">([InvisTVBinder], TcThetaType)
-&gt; TcM ([InvisTVBinder], TcThetaType)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[InvisTVBinder]
</span><a href="#local-6989586621681097965"><span class="hs-identifier hs-var">final_qtvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097969"><span class="hs-identifier hs-var">my_theta</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-998"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-999"></span><span>    </span><span id="local-6989586621681097978"><span class="annot"><span class="annottext">report_dup_tyvar_tv_err :: (Name, Name) -&gt; TcRn ()
</span><a href="#local-6989586621681097978"><span class="hs-identifier hs-var hs-var">report_dup_tyvar_tv_err</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681097960"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097960"><span class="hs-identifier hs-var">n1</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681097959"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097959"><span class="hs-identifier hs-var">n2</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1000"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#PartialSig"><span class="hs-identifier hs-type">PartialSig</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">psig_name :: TcIdSigInfo -&gt; Name
</span><a href="GHC.Tc.Types.html#psig_name"><span class="hs-identifier hs-var">psig_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097956"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097956"><span class="hs-identifier hs-var">fn_name</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">psig_hs_ty :: TcIdSigInfo -&gt; LHsSigWcType (GhcPass 'Renamed)
</span><a href="GHC.Tc.Types.html#psig_hs_ty"><span class="hs-identifier hs-var">psig_hs_ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097954"><span class="annot"><span class="annottext">LHsSigWcType (GhcPass 'Renamed)
</span><a href="#local-6989586621681097954"><span class="hs-identifier hs-var">hs_ty</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097995"><span class="hs-identifier hs-var">sig</span></a></span><span>
</span><span id="line-1001"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#addErrTc"><span class="hs-identifier hs-var">addErrTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; BKey -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Couldn't match&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097960"><span class="hs-identifier hs-var">n1</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1002"></span><span>                        </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;with&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097959"><span class="hs-identifier hs-var">n2</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1003"></span><span>                     </span><span class="annot"><span class="annottext">BKey
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; BKey -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;both bound by the partial type signature:&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1004"></span><span>                           </span><span class="annot"><span class="annottext">BKey
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097956"><span class="hs-identifier hs-var">fn_name</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigWcType (GhcPass 'Renamed) -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigWcType (GhcPass 'Renamed)
</span><a href="#local-6989586621681097954"><span class="hs-identifier hs-var">hs_ty</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1005"></span><span>
</span><span id="line-1006"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-comment">-- Can't happen; by now we know it's a partial sig</span><span>
</span><span id="line-1007"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;report_tyvar_tv_err&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcIdSigInfo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097995"><span class="hs-identifier hs-var">sig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1008"></span><span>
</span><span id="line-1009"></span><span>    </span><span id="local-6989586621681097976"><span class="annot"><span class="annottext">report_mono_sig_tv_err :: Name -&gt; TcRn ()
</span><a href="#local-6989586621681097976"><span class="hs-identifier hs-var hs-var">report_mono_sig_tv_err</span></a></span></span><span> </span><span id="local-6989586621681097951"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097951"><span class="hs-identifier hs-var">n</span></a></span></span><span>
</span><span id="line-1010"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#PartialSig"><span class="hs-identifier hs-type">PartialSig</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">psig_name :: TcIdSigInfo -&gt; Name
</span><a href="GHC.Tc.Types.html#psig_name"><span class="hs-identifier hs-var">psig_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097950"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097950"><span class="hs-identifier hs-var">fn_name</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">psig_hs_ty :: TcIdSigInfo -&gt; LHsSigWcType (GhcPass 'Renamed)
</span><a href="GHC.Tc.Types.html#psig_hs_ty"><span class="hs-identifier hs-var">psig_hs_ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097949"><span class="annot"><span class="annottext">LHsSigWcType (GhcPass 'Renamed)
</span><a href="#local-6989586621681097949"><span class="hs-identifier hs-var">hs_ty</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097995"><span class="hs-identifier hs-var">sig</span></a></span><span>
</span><span id="line-1011"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#addErrTc"><span class="hs-identifier hs-var">addErrTc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; BKey -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Can't quantify over&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#quotes"><span class="hs-identifier hs-var">quotes</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097951"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1012"></span><span>                     </span><span class="annot"><span class="annottext">BKey
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; BKey -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;bound by the partial type signature:&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1013"></span><span>                           </span><span class="annot"><span class="annottext">BKey
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097950"><span class="hs-identifier hs-var">fn_name</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigWcType (GhcPass 'Renamed) -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigWcType (GhcPass 'Renamed)
</span><a href="#local-6989586621681097949"><span class="hs-identifier hs-var">hs_ty</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1014"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-comment">-- Can't happen; by now we know it's a partial sig</span><span>
</span><span id="line-1015"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;report_mono_sig_tv_err&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcIdSigInfo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097995"><span class="hs-identifier hs-var">sig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1016"></span><span>
</span><span id="line-1017"></span><span>    </span><span class="annot"><a href="#local-6989586621681097968"><span class="hs-identifier hs-type">choose_psig_context</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Var.Set.html#VarSet"><span class="hs-identifier hs-type">VarSet</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-type">TcThetaType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span>
</span><span id="line-1018"></span><span>                        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.Set.html#VarSet"><span class="hs-identifier hs-type">VarSet</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcThetaType"><span class="hs-identifier hs-type">TcThetaType</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1019"></span><span>    </span><span id="local-6989586621681097968"><span class="annot"><span class="annottext">choose_psig_context :: TcTyVarSet
-&gt; TcThetaType -&gt; Maybe Kind -&gt; TcM (TcTyVarSet, TcThetaType)
</span><a href="#local-6989586621681097968"><span class="hs-identifier hs-var hs-var">choose_psig_context</span></a></span></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681097947"><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097947"><span class="hs-identifier hs-var">annotated_theta</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe Kind
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1020"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097946"><span class="annot"><span class="annottext">free_tvs :: TcTyVarSet
</span><a href="#local-6989586621681097946"><span class="hs-identifier hs-var hs-var">free_tvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVarSet -&gt; TcTyVarSet
</span><a href="GHC.Core.TyCo.FVs.html#closeOverKinds"><span class="hs-identifier hs-var">closeOverKinds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcThetaType -&gt; TcTyVarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypes"><span class="hs-identifier hs-var">tyCoVarsOfTypes</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097947"><span class="hs-identifier hs-var">annotated_theta</span></a></span><span>
</span><span id="line-1021"></span><span>                                            </span><span class="annot"><span class="annottext">TcTyVarSet -&gt; TcTyVarSet -&gt; TcTyVarSet
</span><a href="GHC.Types.Var.Set.html#unionVarSet"><span class="hs-operator hs-var">`unionVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097997"><span class="hs-identifier hs-var">tau_tvs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1022"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TcTyVarSet, TcThetaType) -&gt; TcM (TcTyVarSet, TcThetaType)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097946"><span class="hs-identifier hs-var">free_tvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097947"><span class="hs-identifier hs-var">annotated_theta</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1023"></span><span>
</span><span id="line-1024"></span><span>    </span><span class="annot"><a href="#local-6989586621681097968"><span class="hs-identifier hs-var">choose_psig_context</span></a></span><span> </span><span id="local-6989586621681097944"><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097944"><span class="hs-identifier hs-var">psig_qtvs</span></a></span></span><span> </span><span id="local-6989586621681097943"><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097943"><span class="hs-identifier hs-var">annotated_theta</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681097942"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097942"><span class="hs-identifier hs-var">wc_var_ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1025"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097941"><span class="annot"><span class="annottext">free_tvs :: TcTyVarSet
</span><a href="#local-6989586621681097941"><span class="hs-identifier hs-var hs-var">free_tvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVarSet -&gt; TcTyVarSet
</span><a href="GHC.Core.TyCo.FVs.html#closeOverKinds"><span class="hs-identifier hs-var">closeOverKinds</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcThetaType -&gt; TcTyVarSet -&gt; TcTyVarSet
</span><a href="GHC.Tc.Solver.html#growThetaTyVars"><span class="hs-identifier hs-var">growThetaTyVars</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097998"><span class="hs-identifier hs-var">inferred_theta</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097940"><span class="hs-identifier hs-var">seed_tvs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1026"></span><span>                            </span><span class="hs-comment">-- growThetaVars just like the no-type-sig case</span><span>
</span><span id="line-1027"></span><span>                            </span><span class="hs-comment">-- Omitting this caused #12844</span><span>
</span><span id="line-1028"></span><span>                 </span><span id="local-6989586621681097940"><span class="annot"><span class="annottext">seed_tvs :: TcTyVarSet
</span><a href="#local-6989586621681097940"><span class="hs-identifier hs-var hs-var">seed_tvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcThetaType -&gt; TcTyVarSet
</span><a href="GHC.Core.TyCo.FVs.html#tyCoVarsOfTypes"><span class="hs-identifier hs-var">tyCoVarsOfTypes</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097943"><span class="hs-identifier hs-var">annotated_theta</span></a></span><span>  </span><span class="hs-comment">-- These are put there</span><span>
</span><span id="line-1029"></span><span>                            </span><span class="annot"><span class="annottext">TcTyVarSet -&gt; TcTyVarSet -&gt; TcTyVarSet
</span><a href="GHC.Types.Var.Set.html#unionVarSet"><span class="hs-operator hs-var">`unionVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097997"><span class="hs-identifier hs-var">tau_tvs</span></a></span><span>            </span><span class="hs-comment">--       by the user</span><span>
</span><span id="line-1030"></span><span>
</span><span id="line-1031"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097939"><span class="annot"><span class="annottext">keep_me :: TcTyVarSet
</span><a href="#local-6989586621681097939"><span class="hs-identifier hs-var hs-var">keep_me</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097944"><span class="hs-identifier hs-var">psig_qtvs</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet -&gt; TcTyVarSet -&gt; TcTyVarSet
</span><a href="GHC.Types.Var.Set.html#unionVarSet"><span class="hs-operator hs-var">`unionVarSet`</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097941"><span class="hs-identifier hs-var">free_tvs</span></a></span><span>
</span><span id="line-1032"></span><span>                 </span><span id="local-6989586621681097938"><span class="annot"><span class="annottext">my_theta :: TcThetaType
</span><a href="#local-6989586621681097938"><span class="hs-identifier hs-var hs-var">my_theta</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcTyVarSet -&gt; TcThetaType -&gt; TcThetaType
</span><a href="GHC.Tc.Utils.TcType.html#pickCapturedPreds"><span class="hs-identifier hs-var">pickCapturedPreds</span></a></span><span> </span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097939"><span class="hs-identifier hs-var">keep_me</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097998"><span class="hs-identifier hs-var">inferred_theta</span></a></span><span>
</span><span id="line-1033"></span><span>
</span><span id="line-1034"></span><span>           </span><span class="hs-comment">-- Fill in the extra-constraints wildcard hole with inferred_theta,</span><span>
</span><span id="line-1035"></span><span>           </span><span class="hs-comment">-- so that the Hole constraint we have already emitted</span><span>
</span><span id="line-1036"></span><span>           </span><span class="hs-comment">-- (in tcHsPartialSigType) can report what filled it in.</span><span>
</span><span id="line-1037"></span><span>           </span><span class="hs-comment">-- NB: my_theta already includes all the annotated constraints</span><span>
</span><span id="line-1038"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097937"><span class="annot"><span class="annottext">inferred_diff :: TcThetaType
</span><a href="#local-6989586621681097937"><span class="hs-identifier hs-var hs-var">inferred_diff</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097936"><span class="hs-identifier hs-var">pred</span></a></span><span>
</span><span id="line-1039"></span><span>                                 </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681097936"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097936"><span class="hs-identifier hs-var">pred</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097938"><span class="hs-identifier hs-var">my_theta</span></a></span><span>
</span><span id="line-1040"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">(Kind -&gt; Bool) -&gt; TcThetaType -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Kind -&gt; Bool) -&gt; Kind -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind -&gt; Kind -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097936"><span class="hs-identifier hs-var">pred</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097943"><span class="hs-identifier hs-var">annotated_theta</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1041"></span><span>           </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681097934"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097934"><span class="hs-identifier hs-var">ctuple</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcThetaType -&gt; TcM Kind
forall {m :: * -&gt; *}. Monad m =&gt; TcThetaType -&gt; m Kind
</span><a href="#local-6989586621681097933"><span class="hs-identifier hs-var">mk_ctuple</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097937"><span class="hs-identifier hs-var">inferred_diff</span></a></span><span>
</span><span id="line-1042"></span><span>
</span><span id="line-1043"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; Maybe (TcId, TcCoercionR)
</span><a href="GHC.Tc.Utils.TcType.html#tcGetCastedTyVar_maybe"><span class="hs-identifier hs-var">tcGetCastedTyVar_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097942"><span class="hs-identifier hs-var">wc_var_ty</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1044"></span><span>               </span><span class="hs-comment">-- We know that wc_co must have type kind(wc_var) ~ Constraint, as it</span><span>
</span><span id="line-1045"></span><span>               </span><span class="hs-comment">-- comes from the checkExpectedKind in GHC.Tc.Gen.HsType.tcAnonWildCardOcc. So, to</span><span>
</span><span id="line-1046"></span><span>               </span><span class="hs-comment">-- make the kinds work out, we reverse the cast here.</span><span>
</span><span id="line-1047"></span><span>               </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681097931"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097931"><span class="hs-identifier hs-var">wc_var</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097930"><span class="annot"><span class="annottext">TcCoercionR
</span><a href="#local-6989586621681097930"><span class="hs-identifier hs-var">wc_co</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcId -&gt; Kind -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.TcMType.html#writeMetaTyVar"><span class="hs-identifier hs-var">writeMetaTyVar</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097931"><span class="hs-identifier hs-var">wc_var</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097934"><span class="hs-identifier hs-var">ctuple</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; TcCoercionR -&gt; Kind
</span><a href="GHC.Core.Type.html#mkCastTy"><span class="hs-operator hs-var">`mkCastTy`</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercionR -&gt; TcCoercionR
</span><a href="GHC.Tc.Types.Evidence.html#mkTcSymCo"><span class="hs-identifier hs-var">mkTcSymCo</span></a></span><span> </span><span class="annot"><span class="annottext">TcCoercionR
</span><a href="#local-6989586621681097930"><span class="hs-identifier hs-var">wc_co</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1048"></span><span>               </span><span class="annot"><span class="annottext">Maybe (TcId, TcCoercionR)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;chooseInferredQuantifiers 1&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097942"><span class="hs-identifier hs-var">wc_var_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1049"></span><span>
</span><span id="line-1050"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;completeTheta&quot;</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; TcRn ()) -&gt; SDoc -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1051"></span><span>                </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097995"><span class="hs-identifier hs-var">sig</span></a></span><span>
</span><span id="line-1052"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcThetaType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097943"><span class="hs-identifier hs-var">annotated_theta</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcThetaType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097998"><span class="hs-identifier hs-var">inferred_theta</span></a></span><span>
</span><span id="line-1053"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcThetaType -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097937"><span class="hs-identifier hs-var">inferred_diff</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1054"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TcTyVarSet, TcThetaType) -&gt; TcM (TcTyVarSet, TcThetaType)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcTyVarSet
</span><a href="#local-6989586621681097941"><span class="hs-identifier hs-var">free_tvs</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097938"><span class="hs-identifier hs-var">my_theta</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1055"></span><span>
</span><span id="line-1056"></span><span>    </span><span id="local-6989586621681097933"><span class="annot"><span class="annottext">mk_ctuple :: TcThetaType -&gt; m Kind
</span><a href="#local-6989586621681097933"><span class="hs-identifier hs-var hs-var">mk_ctuple</span></a></span></span><span> </span><span id="local-6989586621681097925"><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097925"><span class="hs-identifier hs-var">preds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; m Kind
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcThetaType -&gt; Kind
</span><a href="GHC.Builtin.Types.html#mkBoxedTupleTy"><span class="hs-identifier hs-var">mkBoxedTupleTy</span></a></span><span> </span><span class="annot"><span class="annottext">TcThetaType
</span><a href="#local-6989586621681097925"><span class="hs-identifier hs-var">preds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1057"></span><span>       </span><span class="hs-comment">-- Hack alert!  See GHC.Tc.Gen.HsType:</span><span>
</span><span id="line-1058"></span><span>       </span><span class="hs-comment">-- Note [Extra-constraint holes in partial type signatures]</span><span>
</span><span id="line-1059"></span><span>
</span><span id="line-1060"></span><span>
</span><span id="line-1061"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#mk_impedance_match_msg"><span class="hs-identifier hs-type">mk_impedance_match_msg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MonoBindInfo"><span class="hs-identifier hs-type">MonoBindInfo</span></a></span><span>
</span><span id="line-1062"></span><span>                       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span>
</span><span id="line-1063"></span><span>                       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#TidyEnv"><span class="hs-identifier hs-type">TidyEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.Env.html#TidyEnv"><span class="hs-identifier hs-type">TidyEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1064"></span><span class="hs-comment">-- This is a rare but rather awkward error messages</span><span>
</span><span id="line-1065"></span><span id="mk_impedance_match_msg"><span class="annot"><span class="annottext">mk_impedance_match_msg :: MonoBindInfo -&gt; Kind -&gt; Kind -&gt; TidyEnv -&gt; TcM (TidyEnv, SDoc)
</span><a href="GHC.Tc.Gen.Bind.html#mk_impedance_match_msg"><span class="hs-identifier hs-var hs-var">mk_impedance_match_msg</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MBI"><span class="hs-identifier hs-type">MBI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mbi_poly_name :: MonoBindInfo -&gt; Name
</span><a href="GHC.Tc.Gen.Bind.html#mbi_poly_name"><span class="hs-identifier hs-var">mbi_poly_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097924"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097924"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_sig :: MonoBindInfo -&gt; Maybe TcIdSigInst
</span><a href="GHC.Tc.Gen.Bind.html#mbi_sig"><span class="hs-identifier hs-var">mbi_sig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097923"><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681097923"><span class="hs-identifier hs-var">mb_sig</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1066"></span><span>                       </span><span id="local-6989586621681097922"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097922"><span class="hs-identifier hs-var">inf_ty</span></a></span></span><span> </span><span id="local-6989586621681097921"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097921"><span class="hs-identifier hs-var">sig_ty</span></a></span></span><span> </span><span id="local-6989586621681097920"><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097920"><span class="hs-identifier hs-var">tidy_env</span></a></span></span><span>
</span><span id="line-1067"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681097919"><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097919"><span class="hs-identifier hs-var">tidy_env1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097918"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097918"><span class="hs-identifier hs-var">inf_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TidyEnv -&gt; Kind -&gt; TcM (TidyEnv, Kind)
</span><a href="GHC.Tc.Utils.TcMType.html#zonkTidyTcType"><span class="hs-identifier hs-var">zonkTidyTcType</span></a></span><span> </span><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097920"><span class="hs-identifier hs-var">tidy_env</span></a></span><span>  </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097922"><span class="hs-identifier hs-var">inf_ty</span></a></span><span>
</span><span id="line-1068"></span><span>      </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681097916"><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097916"><span class="hs-identifier hs-var">tidy_env2</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097915"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097915"><span class="hs-identifier hs-var">sig_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TidyEnv -&gt; Kind -&gt; TcM (TidyEnv, Kind)
</span><a href="GHC.Tc.Utils.TcMType.html#zonkTidyTcType"><span class="hs-identifier hs-var">zonkTidyTcType</span></a></span><span> </span><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097919"><span class="hs-identifier hs-var">tidy_env1</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097921"><span class="hs-identifier hs-var">sig_ty</span></a></span><span>
</span><span id="line-1069"></span><span>      </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097914"><span class="annot"><span class="annottext">msg :: SDoc
</span><a href="#local-6989586621681097914"><span class="hs-identifier hs-var hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;When checking that the inferred type&quot;</span></span><span>
</span><span id="line-1070"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">BKey -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">BKey
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; SDoc -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097924"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097918"><span class="hs-identifier hs-var">inf_ty</span></a></span><span>
</span><span id="line-1071"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;is as general as its&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681097912"><span class="hs-identifier hs-var">what</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;signature&quot;</span></span><span>
</span><span id="line-1072"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">BKey -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">BKey
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; SDoc -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097924"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097915"><span class="hs-identifier hs-var">sig_ty</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1073"></span><span>      </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TidyEnv, SDoc) -&gt; TcM (TidyEnv, SDoc)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097916"><span class="hs-identifier hs-var">tidy_env2</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681097914"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1074"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1075"></span><span>    </span><span id="local-6989586621681097912"><span class="annot"><span class="annottext">what :: SDoc
</span><a href="#local-6989586621681097912"><span class="hs-identifier hs-var hs-var">what</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681097923"><span class="hs-identifier hs-var">mb_sig</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1076"></span><span>             </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;inferred&quot;</span></span><span>
</span><span id="line-1077"></span><span>             </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681097911"><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097911"><span class="hs-identifier hs-var">sig</span></a></span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">TcIdSigInst -&gt; Bool
</span><a href="GHC.Tc.Types.html#isPartialSig"><span class="hs-identifier hs-var">isPartialSig</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097911"><span class="hs-identifier hs-var">sig</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;(partial)&quot;</span></span><span>
</span><span id="line-1078"></span><span>                      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>        </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">empty</span></a></span><span>
</span><span id="line-1079"></span><span>
</span><span id="line-1080"></span><span>
</span><span id="line-1081"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#mk_inf_msg"><span class="hs-identifier hs-type">mk_inf_msg</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcType"><span class="hs-identifier hs-type">TcType</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.Env.html#TidyEnv"><span class="hs-identifier hs-type">TidyEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Var.Env.html#TidyEnv"><span class="hs-identifier hs-type">TidyEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1082"></span><span id="mk_inf_msg"><span class="annot"><span class="annottext">mk_inf_msg :: Name -&gt; Kind -&gt; TidyEnv -&gt; TcM (TidyEnv, SDoc)
</span><a href="GHC.Tc.Gen.Bind.html#mk_inf_msg"><span class="hs-identifier hs-var hs-var">mk_inf_msg</span></a></span></span><span> </span><span id="local-6989586621681097909"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097909"><span class="hs-identifier hs-var">poly_name</span></a></span></span><span> </span><span id="local-6989586621681097908"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097908"><span class="hs-identifier hs-var">poly_ty</span></a></span></span><span> </span><span id="local-6989586621681097907"><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097907"><span class="hs-identifier hs-var">tidy_env</span></a></span></span><span>
</span><span id="line-1083"></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681097906"><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097906"><span class="hs-identifier hs-var">tidy_env1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097905"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097905"><span class="hs-identifier hs-var">poly_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TidyEnv -&gt; Kind -&gt; TcM (TidyEnv, Kind)
</span><a href="GHC.Tc.Utils.TcMType.html#zonkTidyTcType"><span class="hs-identifier hs-var">zonkTidyTcType</span></a></span><span> </span><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097907"><span class="hs-identifier hs-var">tidy_env</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097908"><span class="hs-identifier hs-var">poly_ty</span></a></span><span>
</span><span id="line-1084"></span><span>      </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097904"><span class="annot"><span class="annottext">msg :: SDoc
</span><a href="#local-6989586621681097904"><span class="hs-identifier hs-var hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;When checking the inferred type&quot;</span></span><span>
</span><span id="line-1085"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">BKey -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">BKey
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; SDoc -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097909"><span class="hs-identifier hs-var">poly_name</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097905"><span class="hs-identifier hs-var">poly_ty</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1086"></span><span>      </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(TidyEnv, SDoc) -&gt; TcM (TidyEnv, SDoc)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097906"><span class="hs-identifier hs-var">tidy_env1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681097904"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1087"></span><span>
</span><span id="line-1088"></span><span>
</span><span id="line-1089"></span><span class="hs-comment">-- | Warn the user about polymorphic local binders that lack type signatures.</span><span>
</span><span id="line-1090"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#localSigWarn"><span class="hs-identifier hs-type">localSigWarn</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Flags.html#WarningFlag"><span class="hs-identifier hs-type">WarningFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInst"><span class="hs-identifier hs-type">TcIdSigInst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1091"></span><span id="localSigWarn"><span class="annot"><span class="annottext">localSigWarn :: WarningFlag -&gt; TcId -&gt; Maybe TcIdSigInst -&gt; TcRn ()
</span><a href="GHC.Tc.Gen.Bind.html#localSigWarn"><span class="hs-identifier hs-var hs-var">localSigWarn</span></a></span></span><span> </span><span id="local-6989586621681097903"><span class="annot"><span class="annottext">WarningFlag
</span><a href="#local-6989586621681097903"><span class="hs-identifier hs-var">flag</span></a></span></span><span> </span><span id="local-6989586621681097902"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097902"><span class="hs-identifier hs-var">id</span></a></span></span><span> </span><span id="local-6989586621681097901"><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681097901"><span class="hs-identifier hs-var">mb_sig</span></a></span></span><span>
</span><span id="line-1092"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInst
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681097901"><span class="hs-identifier hs-var">mb_sig</span></a></span><span>               </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1093"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind -&gt; Bool
</span><a href="GHC.Tc.Utils.TcType.html#isSigmaTy"><span class="hs-identifier hs-var">isSigmaTy</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097902"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1094"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">WarningFlag -&gt; SDoc -&gt; TcId -&gt; TcRn ()
</span><a href="GHC.Tc.Gen.Bind.html#warnMissingSignatures"><span class="hs-identifier hs-var">warnMissingSignatures</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="#local-6989586621681097903"><span class="hs-identifier hs-var">flag</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681097898"><span class="hs-identifier hs-var">msg</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097902"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-1095"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1096"></span><span>    </span><span id="local-6989586621681097898"><span class="annot"><span class="annottext">msg :: SDoc
</span><a href="#local-6989586621681097898"><span class="hs-identifier hs-var hs-var">msg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Polymorphic local binding with no type signature:&quot;</span></span><span>
</span><span id="line-1097"></span><span>
</span><span id="line-1098"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#warnMissingSignatures"><span class="hs-identifier hs-type">warnMissingSignatures</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Flags.html#WarningFlag"><span class="hs-identifier hs-type">WarningFlag</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Var.html#Id"><span class="hs-identifier hs-type">Id</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1099"></span><span id="warnMissingSignatures"><span class="annot"><span class="annottext">warnMissingSignatures :: WarningFlag -&gt; SDoc -&gt; TcId -&gt; TcRn ()
</span><a href="GHC.Tc.Gen.Bind.html#warnMissingSignatures"><span class="hs-identifier hs-var hs-var">warnMissingSignatures</span></a></span></span><span> </span><span id="local-6989586621681097897"><span class="annot"><span class="annottext">WarningFlag
</span><a href="#local-6989586621681097897"><span class="hs-identifier hs-var">flag</span></a></span></span><span> </span><span id="local-6989586621681097896"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681097896"><span class="hs-identifier hs-var">msg</span></a></span></span><span> </span><span id="local-6989586621681097895"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097895"><span class="hs-identifier hs-var">id</span></a></span></span><span>
</span><span id="line-1100"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681097894"><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097894"><span class="hs-identifier hs-var">env0</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM TidyEnv
</span><a href="GHC.Tc.Utils.Env.html#tcInitTidyEnv"><span class="hs-identifier hs-var">tcInitTidyEnv</span></a></span><span>
</span><span id="line-1101"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681097892"><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097892"><span class="hs-identifier hs-var">env1</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097891"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097891"><span class="hs-identifier hs-var">tidy_ty</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TidyEnv -&gt; Kind -&gt; (TidyEnv, Kind)
</span><a href="GHC.Core.TyCo.Tidy.html#tidyOpenType"><span class="hs-identifier hs-var">tidyOpenType</span></a></span><span> </span><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097894"><span class="hs-identifier hs-var">env0</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097895"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1102"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">WarnReason -&gt; (TidyEnv, SDoc) -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#addWarnTcM"><span class="hs-identifier hs-var">addWarnTcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">WarningFlag -&gt; WarnReason
</span><a href="GHC.Driver.Flags.html#Reason"><span class="hs-identifier hs-var">Reason</span></a></span><span> </span><span class="annot"><span class="annottext">WarningFlag
</span><a href="#local-6989586621681097897"><span class="hs-identifier hs-var">flag</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TidyEnv
</span><a href="#local-6989586621681097892"><span class="hs-identifier hs-var">env1</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
</span><a href="#local-6989586621681097888"><span class="hs-identifier hs-var">mk_msg</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097891"><span class="hs-identifier hs-var">tidy_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1103"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1104"></span><span>    </span><span id="local-6989586621681097888"><span class="annot"><span class="annottext">mk_msg :: Kind -&gt; SDoc
</span><a href="#local-6989586621681097888"><span class="hs-identifier hs-var hs-var">mk_msg</span></a></span></span><span> </span><span id="local-6989586621681097887"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097887"><span class="hs-identifier hs-var">ty</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#sep"><span class="hs-identifier hs-var">sep</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681097896"><span class="hs-identifier hs-var">msg</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">BKey -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">BKey
</span><span class="hs-number">2</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; SDoc) -&gt; SDoc -&gt; SDoc
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. NamedThing a =&gt; a -&gt; SDoc
</span><a href="GHC.Types.Name.html#pprPrefixName"><span class="hs-identifier hs-var">pprPrefixName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097895"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097887"><span class="hs-identifier hs-var">ty</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1105"></span><span>
</span><span id="line-1106"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#checkOverloadedSig"><span class="hs-identifier hs-type">checkOverloadedSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInst"><span class="hs-identifier hs-type">TcIdSigInst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1107"></span><span class="hs-comment">-- Example:</span><span>
</span><span id="line-1108"></span><span class="hs-comment">--   f :: Eq a =&gt; a -&gt; a</span><span>
</span><span id="line-1109"></span><span class="hs-comment">--   K f = e</span><span>
</span><span id="line-1110"></span><span class="hs-comment">-- The MR applies, but the signature is overloaded, and it's</span><span>
</span><span id="line-1111"></span><span class="hs-comment">-- best to complain about this directly</span><span>
</span><span id="line-1112"></span><span class="hs-comment">-- c.f #11339</span><span>
</span><span id="line-1113"></span><span id="checkOverloadedSig"><span class="annot"><span class="annottext">checkOverloadedSig :: Bool -&gt; TcIdSigInst -&gt; TcRn ()
</span><a href="GHC.Tc.Gen.Bind.html#checkOverloadedSig"><span class="hs-identifier hs-var hs-var">checkOverloadedSig</span></a></span></span><span> </span><span id="local-6989586621681097883"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681097883"><span class="hs-identifier hs-var">monomorphism_restriction_applies</span></a></span></span><span> </span><span id="local-6989586621681097882"><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097882"><span class="hs-identifier hs-var">sig</span></a></span></span><span>
</span><span id="line-1114"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcThetaType -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcIdSigInst -&gt; TcThetaType
</span><a href="GHC.Tc.Types.html#sig_inst_theta"><span class="hs-identifier hs-var hs-var">sig_inst_theta</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097882"><span class="hs-identifier hs-var">sig</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1115"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681097883"><span class="hs-identifier hs-var">monomorphism_restriction_applies</span></a></span><span>
</span><span id="line-1116"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097881"><span class="annot"><span class="annottext">orig_sig :: TcIdSigInfo
</span><a href="#local-6989586621681097881"><span class="hs-identifier hs-var hs-var">orig_sig</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcIdSigInst -&gt; TcIdSigInfo
</span><a href="GHC.Tc.Types.html#sig_inst_sig"><span class="hs-identifier hs-var hs-var">sig_inst_sig</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097882"><span class="hs-identifier hs-var">sig</span></a></span><span>
</span><span id="line-1117"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; TcRn () -&gt; TcRn ()
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcIdSigInfo -&gt; SrcSpan
</span><a href="GHC.Tc.Types.html#sig_loc"><span class="hs-identifier hs-var hs-var">sig_loc</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097881"><span class="hs-identifier hs-var">orig_sig</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcRn () -&gt; TcRn ()) -&gt; TcRn () -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1118"></span><span>    </span><span class="annot"><span class="annottext">SDoc -&gt; TcRn ()
forall a. SDoc -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#failWith"><span class="hs-identifier hs-var">failWith</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; TcRn ()) -&gt; SDoc -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1119"></span><span>    </span><span class="annot"><span class="annottext">SDoc -&gt; BKey -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Overloaded signature conflicts with monomorphism restriction&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-1120"></span><span>       </span><span class="annot"><span class="annottext">BKey
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcIdSigInfo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097881"><span class="hs-identifier hs-var">orig_sig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1121"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1122"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; TcRn ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-1123"></span><span>
</span><span id="line-1124"></span><span class="hs-comment">{- Note [Partial type signatures and generalisation]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If /any/ of the signatures in the group is a partial type signature
   f :: _ -&gt; Int
then we *always* use the InferGen plan, and hence tcPolyInfer.
We do this even for a local binding with -XMonoLocalBinds, when
we normally use NoGen.

Reasons:
  * The TcSigInfo for 'f' has a unification variable for the '_',
    whose TcLevel is one level deeper than the current level.
    (See pushTcLevelM in tcTySig.)  But NoGen doesn't increase
    the TcLevel like InferGen, so we lose the level invariant.

  * The signature might be   f :: forall a. _ -&gt; a
    so it really is polymorphic.  It's not clear what it would
    mean to use NoGen on this, and indeed the ASSERT in tcLhs,
    in the (Just sig) case, checks that if there is a signature
    then we are using LetLclBndr, and hence a nested AbsBinds with
    increased TcLevel

It might be possible to fix these difficulties somehow, but there
doesn't seem much point.  Indeed, adding a partial type signature is a
way to get per-binding inferred generalisation.

We apply the MR if /all/ of the partial signatures lack a context.
In particular (#11016):
   f2 :: (?loc :: Int) =&gt; _
   f2 = ?loc
It's stupid to apply the MR here.  This test includes an extra-constraints
wildcard; that is, we don't apply the MR if you write
   f3 :: _ =&gt; blah

Note [Quantified variables in partial type signatures]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
  f :: forall a. a -&gt; a -&gt; _
  f x y = g x y
  g :: forall b. b -&gt; b -&gt; _
  g x y = [x, y]

Here, 'f' and 'g' are mutually recursive, and we end up unifying 'a' and 'b'
together, which is fine.  So we bind 'a' and 'b' to TyVarTvs, which can then
unify with each other.

But now consider:
  f :: forall a b. a -&gt; b -&gt; _
  f x y = [x, y]

We want to get an error from this, because 'a' and 'b' get unified.
So we make a test, one per partial signature, to check that the
explicitly-quantified type variables have not been unified together.
#14449 showed this up.


Note [Validity of inferred types]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
We need to check inferred type for validity, in case it uses language
extensions that are not turned on.  The principle is that if the user
simply adds the inferred type to the program source, it'll compile fine.
See #8883.

Examples that might fail:
 - the type might be ambiguous

 - an inferred theta that requires type equalities e.g. (F a ~ G b)
                                or multi-parameter type classes
 - an inferred type that includes unboxed tuples


Note [Impedance matching]
~~~~~~~~~~~~~~~~~~~~~~~~~
Consider
   f 0 x = x
   f n x = g [] (not x)

   g [] y = f 10 y
   g _  y = f 9  y

After typechecking we'll get
  f_mono_ty :: a -&gt; Bool -&gt; Bool
  g_mono_ty :: [b] -&gt; Bool -&gt; Bool
with constraints
  (Eq a, Num a)

Note that f is polymorphic in 'a' and g in 'b'; and these are not linked.
The types we really want for f and g are
   f :: forall a. (Eq a, Num a) =&gt; a -&gt; Bool -&gt; Bool
   g :: forall b. [b] -&gt; Bool -&gt; Bool

We can get these by &quot;impedance matching&quot;:
   tuple :: forall a b. (Eq a, Num a) =&gt; (a -&gt; Bool -&gt; Bool, [b] -&gt; Bool -&gt; Bool)
   tuple a b d1 d1 = let ...bind f_mono, g_mono in (f_mono, g_mono)

   f a d1 d2 = case tuple a Any d1 d2 of (f, g) -&gt; f
   g b = case tuple Integer b dEqInteger dNumInteger of (f,g) -&gt; g

Suppose the shared quantified tyvars are qtvs and constraints theta.
Then we want to check that
     forall qtvs. theta =&gt; f_mono_ty   is more polymorphic than   f's polytype
and the proof is the impedance matcher.

Notice that the impedance matcher may do defaulting.  See #7173.

It also cleverly does an ambiguity check; for example, rejecting
   f :: F a -&gt; F a
where F is a non-injective type function.
-}</span><span>
</span><span id="line-1232"></span><span>
</span><span id="line-1233"></span><span>
</span><span id="line-1234"></span><span class="hs-comment">{-
Note [SPECIALISE pragmas]
~~~~~~~~~~~~~~~~~~~~~~~~~
There is no point in a SPECIALISE pragma for a non-overloaded function:
   reverse :: [a] -&gt; [a]
   {-# SPECIALISE reverse :: [Int] -&gt; [Int] #-}

But SPECIALISE INLINE *can* make sense for GADTS:
   data Arr e where
     ArrInt :: !Int -&gt; ByteArray# -&gt; Arr Int
     ArrPair :: !Int -&gt; Arr e1 -&gt; Arr e2 -&gt; Arr (e1, e2)

   (!:) :: Arr e -&gt; Int -&gt; e
   {-# SPECIALISE INLINE (!:) :: Arr Int -&gt; Int -&gt; Int #-}
   {-# SPECIALISE INLINE (!:) :: Arr (a, b) -&gt; Int -&gt; (a, b) #-}
   (ArrInt _ ba)     !: (I# i) = I# (indexIntArray# ba i)
   (ArrPair _ a1 a2) !: i      = (a1 !: i, a2 !: i)

When (!:) is specialised it becomes non-recursive, and can usefully
be inlined.  Scary!  So we only warn for SPECIALISE *without* INLINE
for a non-overloaded function.

************************************************************************
*                                                                      *
                         tcMonoBinds
*                                                                      *
************************************************************************

@tcMonoBinds@ deals with a perhaps-recursive group of HsBinds.
The signatures have been dealt with already.
-}</span><span>
</span><span id="line-1265"></span><span>
</span><span id="line-1266"></span><span class="hs-keyword">data</span><span> </span><span id="MonoBindInfo"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MonoBindInfo"><span class="hs-identifier hs-var">MonoBindInfo</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="MBI"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MBI"><span class="hs-identifier hs-var">MBI</span></a></span></span><span> </span><span class="hs-special">{</span><span> </span><span id="mbi_poly_name"><span class="annot"><span class="annottext">MonoBindInfo -&gt; Name
</span><a href="GHC.Tc.Gen.Bind.html#mbi_poly_name"><span class="hs-identifier hs-var hs-var">mbi_poly_name</span></a></span></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span>
</span><span id="line-1267"></span><span>                        </span><span class="hs-special">,</span><span> </span><span id="mbi_sig"><span class="annot"><span class="annottext">MonoBindInfo -&gt; Maybe TcIdSigInst
</span><a href="GHC.Tc.Gen.Bind.html#mbi_sig"><span class="hs-identifier hs-var hs-var">mbi_sig</span></a></span></span><span>       </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInst"><span class="hs-identifier hs-type">TcIdSigInst</span></a></span><span>
</span><span id="line-1268"></span><span>                        </span><span class="hs-special">,</span><span> </span><span id="mbi_mono_id"><span class="annot"><span class="annottext">MonoBindInfo -&gt; TcId
</span><a href="GHC.Tc.Gen.Bind.html#mbi_mono_id"><span class="hs-identifier hs-var hs-var">mbi_mono_id</span></a></span></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1269"></span><span>
</span><span id="line-1270"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcMonoBinds"><span class="hs-identifier hs-type">tcMonoBinds</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html#RecFlag"><span class="hs-identifier hs-type">RecFlag</span></a></span><span>  </span><span class="hs-comment">-- Whether the binding is recursive for typechecking purposes</span><span>
</span><span id="line-1271"></span><span>                        </span><span class="hs-comment">-- i.e. the binders are mentioned in their RHSs, and</span><span>
</span><span id="line-1272"></span><span>                        </span><span class="hs-comment">--      we are not rescued by a type signature</span><span>
</span><span id="line-1273"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier hs-type">TcSigFun</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetBndrSpec"><span class="hs-identifier hs-type">LetBndrSpec</span></a></span><span>
</span><span id="line-1274"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBind"><span class="hs-identifier hs-type">LHsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1275"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBinds"><span class="hs-identifier hs-type">LHsBinds</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MonoBindInfo"><span class="hs-identifier hs-type">MonoBindInfo</span></a></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-1276"></span><span id="tcMonoBinds"><span class="annot"><span class="annottext">tcMonoBinds :: RecFlag
-&gt; TcSigFun
-&gt; LetBndrSpec
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
</span><a href="GHC.Tc.Gen.Bind.html#tcMonoBinds"><span class="hs-identifier hs-var hs-var">tcMonoBinds</span></a></span></span><span> </span><span id="local-6989586621681097879"><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681097879"><span class="hs-identifier hs-var">is_rec</span></a></span></span><span> </span><span id="local-6989586621681097878"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681097878"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span> </span><span id="local-6989586621681097877"><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097877"><span class="hs-identifier hs-var">no_gen</span></a></span></span><span>
</span><span id="line-1277"></span><span>           </span><span class="hs-special">[</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681097876"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681097876"><span class="hs-identifier hs-var">b_loc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#FunBind"><span class="hs-identifier hs-type">FunBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">fun_id :: forall idL idR. HsBindLR idL idR -&gt; Located (IdP idL)
</span><a href="GHC.Hs.Binds.html#fun_id"><span class="hs-identifier hs-var">fun_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681097875"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681097875"><span class="hs-identifier hs-var">nm_loc</span></a></span></span><span> </span><span id="local-6989586621681097874"><span class="annot"><span class="annottext">IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097874"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-1278"></span><span>                              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fun_matches :: forall idL idR. HsBindLR idL idR -&gt; MatchGroup idR (LHsExpr idR)
</span><a href="GHC.Hs.Binds.html#fun_matches"><span class="hs-identifier hs-var">fun_matches</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097873"><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097873"><span class="hs-identifier hs-var">matches</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1279"></span><span>                             </span><span class="hs-comment">-- Single function binding,</span><span>
</span><span id="line-1280"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="GHC.Types.Basic.html#NonRecursive"><span class="hs-identifier hs-var">NonRecursive</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><a href="#local-6989586621681097879"><span class="hs-identifier hs-var">is_rec</span></a></span><span>   </span><span class="hs-comment">-- ...binder isn't mentioned in RHS</span><span>
</span><span id="line-1281"></span><span>  </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Maybe TcSigInfo
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681097878"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097874"><span class="hs-identifier hs-var">name</span></a></span><span>   </span><span class="hs-comment">-- ...with no type signature</span><span>
</span><span id="line-1282"></span><span>  </span><span class="hs-glyph">=</span><span>     </span><span class="hs-comment">-- Note [Single function non-recursive binding special-case]</span><span>
</span><span id="line-1283"></span><span>        </span><span class="hs-comment">-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</span><span>
</span><span id="line-1284"></span><span>        </span><span class="hs-comment">-- In this very special case we infer the type of the</span><span>
</span><span id="line-1285"></span><span>        </span><span class="hs-comment">-- right hand side first (it may have a higher-rank type)</span><span>
</span><span id="line-1286"></span><span>        </span><span class="hs-comment">-- and *then* make the monomorphic Id for the LHS</span><span>
</span><span id="line-1287"></span><span>        </span><span class="hs-comment">-- e.g.         f = \(x::forall a. a-&gt;a) -&gt; &lt;body&gt;</span><span>
</span><span id="line-1288"></span><span>        </span><span class="hs-comment">--      We want to infer a higher-rank type for f</span><span>
</span><span id="line-1289"></span><span>    </span><span class="annot"><span class="annottext">SrcSpan
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
forall a. SrcSpan -&gt; TcRn a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#setSrcSpan"><span class="hs-identifier hs-var">setSrcSpan</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681097876"><span class="hs-identifier hs-var">b_loc</span></a></span><span>    </span><span class="annot"><span class="annottext">(TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
 -&gt; TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo]))
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1290"></span><span>    </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621681097872"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681097872"><span class="hs-identifier hs-var">co_fn</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097871"><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681097871"><span class="hs-identifier hs-var">matches'</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097870"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097870"><span class="hs-identifier hs-var">rhs_ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1291"></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(ExpSigmaType
 -&gt; TcM
      (HsWrapper,
       MatchGroup
         (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
-&gt; TcM
     ((HsWrapper,
       MatchGroup
         (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))),
      Kind)
forall a. (ExpSigmaType -&gt; TcM a) -&gt; TcM (a, Kind)
</span><a href="GHC.Tc.Utils.TcMType.html#tcInfer"><span class="hs-identifier hs-var">tcInfer</span></a></span><span> </span><span class="annot"><span class="annottext">((ExpSigmaType
  -&gt; TcM
       (HsWrapper,
        MatchGroup
          (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
 -&gt; TcM
      ((HsWrapper,
        MatchGroup
          (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))),
       Kind))
-&gt; (ExpSigmaType
    -&gt; TcM
         (HsWrapper,
          MatchGroup
            (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
-&gt; TcM
     ((HsWrapper,
       MatchGroup
         (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))),
      Kind)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621681097868"><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681097868"><span class="hs-identifier hs-var">exp_ty</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1292"></span><span>               </span><span class="annot"><span class="annottext">[TcBinder]
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
forall a. [TcBinder] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendBinderStack"><span class="hs-identifier hs-var">tcExtendBinderStack</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Name -&gt; ExpSigmaType -&gt; TopLevelFlag -&gt; TcBinder
</span><a href="GHC.Tc.Types.html#TcIdBndr_ExpType"><span class="hs-identifier hs-var">TcIdBndr_ExpType</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097874"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681097868"><span class="hs-identifier hs-var">exp_ty</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="GHC.Types.Basic.html#NotTopLevel"><span class="hs-identifier hs-var">NotTopLevel</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">(TcM
   (HsWrapper,
    MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
 -&gt; TcM
      (HsWrapper,
       MatchGroup
         (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1293"></span><span>                  </span><span class="hs-comment">-- We extend the error context even for a non-recursive</span><span>
</span><span id="line-1294"></span><span>                  </span><span class="hs-comment">-- function so that in type error messages we show the</span><span>
</span><span id="line-1295"></span><span>                  </span><span class="hs-comment">-- type of the thing whose rhs we are type checking</span><span>
</span><span id="line-1296"></span><span>               </span><span class="annot"><span class="annottext">Located Name
-&gt; MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
-&gt; ExpSigmaType
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
</span><a href="GHC.Tc.Gen.Match.html#tcMatchesFun"><span class="hs-identifier hs-var">tcMatchesFun</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; Name -&gt; Located Name
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681097875"><span class="hs-identifier hs-var">nm_loc</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097874"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097873"><span class="hs-identifier hs-var">matches</span></a></span><span> </span><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681097868"><span class="hs-identifier hs-var">exp_ty</span></a></span><span>
</span><span id="line-1297"></span><span>
</span><span id="line-1298"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681097866"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097866"><span class="hs-identifier hs-var">mono_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
-&gt; Name -&gt; Kind -&gt; Kind -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="GHC.Tc.Gen.Pat.html#newLetBndr"><span class="hs-identifier hs-var">newLetBndr</span></a></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097877"><span class="hs-identifier hs-var">no_gen</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097874"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097870"><span class="hs-identifier hs-var">rhs_ty</span></a></span><span>
</span><span id="line-1299"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GenLocated
  SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
-&gt; LHsBinds (GhcPass 'Typechecked)
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="annot"><span class="annottext">(GenLocated
   SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
 -&gt; LHsBinds (GhcPass 'Typechecked))
-&gt; GenLocated
     SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
-&gt; LHsBinds (GhcPass 'Typechecked)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
-&gt; HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; GenLocated
     SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681097876"><span class="hs-identifier hs-var">b_loc</span></a></span><span> </span><span class="annot"><span class="annottext">(HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
 -&gt; GenLocated
      SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)))
-&gt; HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; GenLocated
     SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1300"></span><span>                     </span><span class="annot"><span class="annottext">FunBind :: forall idL idR.
XFunBind idL idR
-&gt; Located (IdP idL)
-&gt; MatchGroup idR (LHsExpr idR)
-&gt; [Tickish TcId]
-&gt; HsBindLR idL idR
</span><a href="GHC.Hs.Binds.html#FunBind"><span class="hs-identifier hs-type">FunBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">fun_id :: Located (IdP (GhcPass 'Typechecked))
</span><a href="GHC.Hs.Binds.html#fun_id"><span class="hs-identifier hs-var">fun_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; TcId -&gt; GenLocated SrcSpan TcId
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681097875"><span class="hs-identifier hs-var">nm_loc</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097866"><span class="hs-identifier hs-var">mono_id</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1301"></span><span>                               </span><span class="annot"><span class="annottext">fun_matches :: MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Hs.Binds.html#fun_matches"><span class="hs-identifier hs-var">fun_matches</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681097871"><span class="hs-identifier hs-var">matches'</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-1302"></span><span>                               </span><span class="annot"><span class="annottext">fun_ext :: XFunBind (GhcPass 'Typechecked) (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#fun_ext"><span class="hs-identifier hs-var">fun_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XFunBind (GhcPass 'Typechecked) (GhcPass 'Typechecked)
HsWrapper
</span><a href="#local-6989586621681097872"><span class="hs-identifier hs-var">co_fn</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fun_tick :: [Tickish TcId]
</span><a href="GHC.Hs.Binds.html#fun_tick"><span class="hs-identifier hs-var">fun_tick</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">}</span><span class="hs-special">,</span><span>
</span><span id="line-1303"></span><span>                  </span><span class="hs-special">[</span><span class="annot"><span class="annottext">MBI :: Name -&gt; Maybe TcIdSigInst -&gt; TcId -&gt; MonoBindInfo
</span><a href="GHC.Tc.Gen.Bind.html#MBI"><span class="hs-identifier hs-type">MBI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mbi_poly_name :: Name
</span><a href="GHC.Tc.Gen.Bind.html#mbi_poly_name"><span class="hs-identifier hs-var">mbi_poly_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097874"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1304"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_sig :: Maybe TcIdSigInst
</span><a href="GHC.Tc.Gen.Bind.html#mbi_sig"><span class="hs-identifier hs-var">mbi_sig</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1305"></span><span>                       </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_mono_id :: TcId
</span><a href="GHC.Tc.Gen.Bind.html#mbi_mono_id"><span class="hs-identifier hs-var">mbi_mono_id</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097866"><span class="hs-identifier hs-var">mono_id</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1306"></span><span>
</span><span id="line-1307"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcMonoBinds"><span class="hs-identifier hs-var">tcMonoBinds</span></a></span><span> </span><span class="annot"><span class="annottext">RecFlag
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681097864"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681097864"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span> </span><span id="local-6989586621681097863"><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097863"><span class="hs-identifier hs-var">no_gen</span></a></span></span><span> </span><span id="local-6989586621681097862"><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681097862"><span class="hs-identifier hs-var">binds</span></a></span></span><span>
</span><span id="line-1308"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681097861"><span class="annot"><span class="annottext">[Located TcMonoBind]
</span><a href="#local-6989586621681097861"><span class="hs-identifier hs-var">tc_binds</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(LHsBind (GhcPass 'Renamed)
 -&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located TcMonoBind))
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [Located TcMonoBind]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed) -&gt; TcM TcMonoBind)
-&gt; LHsBind (GhcPass 'Renamed)
-&gt; IOEnv (Env TcGblEnv TcLclEnv) (Located TcMonoBind)
forall a b. (a -&gt; TcM b) -&gt; Located a -&gt; TcM (Located b)
</span><a href="GHC.Tc.Utils.Monad.html#wrapLocM"><span class="hs-identifier hs-var">wrapLocM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcSigFun
-&gt; LetBndrSpec
-&gt; HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
-&gt; TcM TcMonoBind
</span><a href="GHC.Tc.Gen.Bind.html#tcLhs"><span class="hs-identifier hs-var">tcLhs</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681097864"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097863"><span class="hs-identifier hs-var">no_gen</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681097862"><span class="hs-identifier hs-var">binds</span></a></span><span>
</span><span id="line-1309"></span><span>
</span><span id="line-1310"></span><span>        </span><span class="hs-comment">-- Bring the monomorphic Ids, into scope for the RHSs</span><span>
</span><span id="line-1311"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097858"><span class="annot"><span class="annottext">mono_infos :: [MonoBindInfo]
</span><a href="#local-6989586621681097858"><span class="hs-identifier hs-var hs-var">mono_infos</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Located TcMonoBind] -&gt; [MonoBindInfo]
</span><a href="GHC.Tc.Gen.Bind.html#getMonoBindInfo"><span class="hs-identifier hs-var">getMonoBindInfo</span></a></span><span> </span><span class="annot"><span class="annottext">[Located TcMonoBind]
</span><a href="#local-6989586621681097861"><span class="hs-identifier hs-var">tc_binds</span></a></span><span>
</span><span id="line-1312"></span><span>              </span><span id="local-6989586621681097856"><span class="annot"><span class="annottext">rhs_id_env :: [(Name, TcId)]
</span><a href="#local-6989586621681097856"><span class="hs-identifier hs-var hs-var">rhs_id_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097855"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097854"><span class="hs-identifier hs-var">mono_id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1313"></span><span>                           </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MBI"><span class="hs-identifier hs-type">MBI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mbi_poly_name :: MonoBindInfo -&gt; Name
</span><a href="GHC.Tc.Gen.Bind.html#mbi_poly_name"><span class="hs-identifier hs-var">mbi_poly_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097855"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097855"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-1314"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_sig :: MonoBindInfo -&gt; Maybe TcIdSigInst
</span><a href="GHC.Tc.Gen.Bind.html#mbi_sig"><span class="hs-identifier hs-var">mbi_sig</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097853"><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681097853"><span class="hs-identifier hs-var">mb_sig</span></a></span></span><span>
</span><span id="line-1315"></span><span>                                 </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_mono_id :: MonoBindInfo -&gt; TcId
</span><a href="GHC.Tc.Gen.Bind.html#mbi_mono_id"><span class="hs-identifier hs-var">mbi_mono_id</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097854"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097854"><span class="hs-identifier hs-var">mono_id</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097858"><span class="hs-identifier hs-var">mono_infos</span></a></span><span>
</span><span id="line-1316"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681097853"><span class="hs-identifier hs-var">mb_sig</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1317"></span><span>                               </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681097852"><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097852"><span class="hs-identifier hs-var">sig</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TcIdSigInst -&gt; Bool
</span><a href="GHC.Tc.Types.html#isPartialSig"><span class="hs-identifier hs-var">isPartialSig</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097852"><span class="hs-identifier hs-var">sig</span></a></span><span>
</span><span id="line-1318"></span><span>                               </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1319"></span><span>                </span><span class="hs-comment">-- A monomorphic binding for each term variable that lacks</span><span>
</span><span id="line-1320"></span><span>                </span><span class="hs-comment">-- a complete type sig.  (Ones with a sig are already in scope.)</span><span>
</span><span id="line-1321"></span><span>
</span><span id="line-1322"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcMonoBinds&quot;</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; TcRn ()) -&gt; SDoc -&gt; TcRn ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097851"><span class="hs-identifier hs-var">n</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TcId -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097850"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097850"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1323"></span><span>                                       </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681097851"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097851"><span class="hs-identifier hs-var">n</span></a></span></span><span class="hs-special">,</span><span id="local-6989586621681097850"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097850"><span class="hs-identifier hs-var">id</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Name, TcId)]
</span><a href="#local-6989586621681097856"><span class="hs-identifier hs-var">rhs_id_env</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1324"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681097849"><span class="annot"><span class="annottext">[GenLocated
   SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681097849"><span class="hs-identifier hs-var">binds'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[(Name, TcId)]
-&gt; TcM
     [GenLocated
        SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))]
-&gt; TcM
     [GenLocated
        SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))]
forall a. [(Name, TcId)] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendRecIds"><span class="hs-identifier hs-var">tcExtendRecIds</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, TcId)]
</span><a href="#local-6989586621681097856"><span class="hs-identifier hs-var">rhs_id_env</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM
   [GenLocated
      SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))]
 -&gt; TcM
      [GenLocated
         SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))])
-&gt; TcM
     [GenLocated
        SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))]
-&gt; TcM
     [GenLocated
        SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1325"></span><span>                    </span><span class="annot"><span class="annottext">(Located TcMonoBind
 -&gt; IOEnv
      (Env TcGblEnv TcLclEnv)
      (GenLocated
         SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))))
-&gt; [Located TcMonoBind]
-&gt; TcM
     [GenLocated
        SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(TcMonoBind
 -&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)))
-&gt; Located TcMonoBind
-&gt; IOEnv
     (Env TcGblEnv TcLclEnv)
     (GenLocated
        SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)))
forall a b. (a -&gt; TcM b) -&gt; Located a -&gt; TcM (Located b)
</span><a href="GHC.Tc.Utils.Monad.html#wrapLocM"><span class="hs-identifier hs-var">wrapLocM</span></a></span><span> </span><span class="annot"><span class="annottext">TcMonoBind
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Gen.Bind.html#tcRhs"><span class="hs-identifier hs-var">tcRhs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Located TcMonoBind]
</span><a href="#local-6989586621681097861"><span class="hs-identifier hs-var">tc_binds</span></a></span><span>
</span><span id="line-1326"></span><span>
</span><span id="line-1327"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">(LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
-&gt; TcM (LHsBinds (GhcPass 'Typechecked), [MonoBindInfo])
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[GenLocated
   SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))]
-&gt; LHsBinds (GhcPass 'Typechecked)
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="annot"><span class="annottext">[GenLocated
   SrcSpan (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))]
</span><a href="#local-6989586621681097849"><span class="hs-identifier hs-var">binds'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097858"><span class="hs-identifier hs-var">mono_infos</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1328"></span><span>
</span><span id="line-1329"></span><span>
</span><span id="line-1330"></span><span class="hs-comment">------------------------</span><span>
</span><span id="line-1331"></span><span class="hs-comment">-- tcLhs typechecks the LHS of the bindings, to construct the environment in which</span><span>
</span><span id="line-1332"></span><span class="hs-comment">-- we typecheck the RHSs.  Basically what we are doing is this: for each binder:</span><span>
</span><span id="line-1333"></span><span class="hs-comment">--      if there's a signature for it, use the instantiated signature type</span><span>
</span><span id="line-1334"></span><span class="hs-comment">--      otherwise invent a type variable</span><span>
</span><span id="line-1335"></span><span class="hs-comment">-- You see that quite directly in the FunBind case.</span><span>
</span><span id="line-1336"></span><span class="hs-comment">--</span><span>
</span><span id="line-1337"></span><span class="hs-comment">-- But there's a complication for pattern bindings:</span><span>
</span><span id="line-1338"></span><span class="hs-comment">--      data T = MkT (forall a. a-&gt;a)</span><span>
</span><span id="line-1339"></span><span class="hs-comment">--      MkT f = e</span><span>
</span><span id="line-1340"></span><span class="hs-comment">-- Here we can guess a type variable for the entire LHS (which will be refined to T)</span><span>
</span><span id="line-1341"></span><span class="hs-comment">-- but we want to get (f::forall a. a-&gt;a) as the RHS environment.</span><span>
</span><span id="line-1342"></span><span class="hs-comment">-- The simplest way to do this is to typecheck the pattern, and then look up the</span><span>
</span><span id="line-1343"></span><span class="hs-comment">-- bound mono-ids.  Then we want to retain the typechecked pattern to avoid re-doing</span><span>
</span><span id="line-1344"></span><span class="hs-comment">-- it; hence the TcMonoBind data type in which the LHS is done but the RHS isn't</span><span>
</span><span id="line-1345"></span><span>
</span><span id="line-1346"></span><span class="hs-keyword">data</span><span> </span><span id="TcMonoBind"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#TcMonoBind"><span class="hs-identifier hs-var">TcMonoBind</span></a></span></span><span>         </span><span class="hs-comment">-- Half completed; LHS done, RHS not done</span><span>
</span><span id="line-1347"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="TcFunBind"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#TcFunBind"><span class="hs-identifier hs-var">TcFunBind</span></a></span></span><span>  </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MonoBindInfo"><span class="hs-identifier hs-type">MonoBindInfo</span></a></span><span>  </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#MatchGroup"><span class="hs-identifier hs-type">MatchGroup</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1348"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="TcPatBind"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#TcPatBind"><span class="hs-identifier hs-var">TcPatBind</span></a></span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MonoBindInfo"><span class="hs-identifier hs-type">MonoBindInfo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#GRHSs"><span class="hs-identifier hs-type">GRHSs</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Expr.html#LHsExpr"><span class="hs-identifier hs-type">LHsExpr</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1349"></span><span>              </span><span class="annot"><a href="GHC.Tc.Utils.TcType.html#TcSigmaType"><span class="hs-identifier hs-type">TcSigmaType</span></a></span><span>
</span><span id="line-1350"></span><span>
</span><span id="line-1351"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcLhs"><span class="hs-identifier hs-type">tcLhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier hs-type">TcSigFun</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetBndrSpec"><span class="hs-identifier hs-type">LetBndrSpec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#HsBind"><span class="hs-identifier hs-type">HsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#TcMonoBind"><span class="hs-identifier hs-type">TcMonoBind</span></a></span><span>
</span><span id="line-1352"></span><span class="hs-comment">-- Only called with plan InferGen (LetBndrSpec = LetLclBndr)</span><span>
</span><span id="line-1353"></span><span class="hs-comment">--                    or NoGen    (LetBndrSpec = LetGblBndr)</span><span>
</span><span id="line-1354"></span><span class="hs-comment">-- CheckGen is used only for functions with a complete type signature,</span><span>
</span><span id="line-1355"></span><span class="hs-comment">--          and tcPolyCheck doesn't use tcMonoBinds at all</span><span>
</span><span id="line-1356"></span><span>
</span><span id="line-1357"></span><span id="tcLhs"><span class="annot"><span class="annottext">tcLhs :: TcSigFun
-&gt; LetBndrSpec
-&gt; HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
-&gt; TcM TcMonoBind
</span><a href="GHC.Tc.Gen.Bind.html#tcLhs"><span class="hs-identifier hs-var hs-var">tcLhs</span></a></span></span><span> </span><span id="local-6989586621681097841"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681097841"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span> </span><span id="local-6989586621681097840"><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097840"><span class="hs-identifier hs-var">no_gen</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#FunBind"><span class="hs-identifier hs-type">FunBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">fun_id :: forall idL idR. HsBindLR idL idR -&gt; Located (IdP idL)
</span><a href="GHC.Hs.Binds.html#fun_id"><span class="hs-identifier hs-var">fun_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621681097839"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681097839"><span class="hs-identifier hs-var">nm_loc</span></a></span></span><span> </span><span id="local-6989586621681097838"><span class="annot"><span class="annottext">IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097838"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-1358"></span><span>                             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fun_matches :: forall idL idR. HsBindLR idL idR -&gt; MatchGroup idR (LHsExpr idR)
</span><a href="GHC.Hs.Binds.html#fun_matches"><span class="hs-identifier hs-var">fun_matches</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097837"><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097837"><span class="hs-identifier hs-var">matches</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1359"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSig"><span class="hs-identifier hs-type">TcIdSig</span></a></span><span> </span><span id="local-6989586621681097835"><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097835"><span class="hs-identifier hs-var">sig</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681097841"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097838"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1360"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- There is a type signature.</span><span>
</span><span id="line-1361"></span><span>    </span><span class="hs-comment">-- It must be partial; if complete we'd be in tcPolyCheck!</span><span>
</span><span id="line-1362"></span><span>    </span><span class="hs-comment">--    e.g.   f :: _ -&gt; _</span><span>
</span><span id="line-1363"></span><span>    </span><span class="hs-comment">--           f x = ...g...</span><span>
</span><span id="line-1364"></span><span>    </span><span class="hs-comment">--           Just g = ...f...</span><span>
</span><span id="line-1365"></span><span>    </span><span class="hs-comment">-- Hence always typechecked with InferGen</span><span>
</span><span id="line-1366"></span><span>    </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681097834"><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681097834"><span class="hs-identifier hs-var">mono_info</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LetBndrSpec -&gt; (Name, TcIdSigInfo) -&gt; TcM MonoBindInfo
</span><a href="GHC.Tc.Gen.Bind.html#tcLhsSigId"><span class="hs-identifier hs-var">tcLhsSigId</span></a></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097840"><span class="hs-identifier hs-var">no_gen</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097838"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097835"><span class="hs-identifier hs-var">sig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1367"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcMonoBind -&gt; TcM TcMonoBind
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MonoBindInfo
-&gt; SrcSpan
-&gt; MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
-&gt; TcMonoBind
</span><a href="GHC.Tc.Gen.Bind.html#TcFunBind"><span class="hs-identifier hs-var">TcFunBind</span></a></span><span> </span><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681097834"><span class="hs-identifier hs-var">mono_info</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681097839"><span class="hs-identifier hs-var">nm_loc</span></a></span><span> </span><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097837"><span class="hs-identifier hs-var">matches</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1368"></span><span>
</span><span id="line-1369"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>  </span><span class="hs-comment">-- No type signature</span><span>
</span><span id="line-1370"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681097832"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097832"><span class="hs-identifier hs-var">mono_ty</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcM Kind
</span><a href="GHC.Tc.Utils.TcMType.html#newOpenFlexiTyVarTy"><span class="hs-identifier hs-var">newOpenFlexiTyVarTy</span></a></span><span>
</span><span id="line-1371"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681097831"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097831"><span class="hs-identifier hs-var">mono_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
-&gt; Name -&gt; Kind -&gt; Kind -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="GHC.Tc.Gen.Pat.html#newLetBndr"><span class="hs-identifier hs-var">newLetBndr</span></a></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097840"><span class="hs-identifier hs-var">no_gen</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097838"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097832"><span class="hs-identifier hs-var">mono_ty</span></a></span><span>
</span><span id="line-1372"></span><span>          </span><span class="hs-comment">-- This ^ generates a binder with Many multiplicity because all</span><span>
</span><span id="line-1373"></span><span>          </span><span class="hs-comment">-- let/where-binders are unrestricted. When we introduce linear let</span><span>
</span><span id="line-1374"></span><span>          </span><span class="hs-comment">-- binders, we will need to retrieve the multiplicity information.</span><span>
</span><span id="line-1375"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097830"><span class="annot"><span class="annottext">mono_info :: MonoBindInfo
</span><a href="#local-6989586621681097830"><span class="hs-identifier hs-var hs-var">mono_info</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MBI :: Name -&gt; Maybe TcIdSigInst -&gt; TcId -&gt; MonoBindInfo
</span><a href="GHC.Tc.Gen.Bind.html#MBI"><span class="hs-identifier hs-type">MBI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mbi_poly_name :: Name
</span><a href="GHC.Tc.Gen.Bind.html#mbi_poly_name"><span class="hs-identifier hs-var">mbi_poly_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097838"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1376"></span><span>                             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_sig :: Maybe TcIdSigInst
</span><a href="GHC.Tc.Gen.Bind.html#mbi_sig"><span class="hs-identifier hs-var">mbi_sig</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1377"></span><span>                             </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_mono_id :: TcId
</span><a href="GHC.Tc.Gen.Bind.html#mbi_mono_id"><span class="hs-identifier hs-var">mbi_mono_id</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097831"><span class="hs-identifier hs-var">mono_id</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1378"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcMonoBind -&gt; TcM TcMonoBind
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MonoBindInfo
-&gt; SrcSpan
-&gt; MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
-&gt; TcMonoBind
</span><a href="GHC.Tc.Gen.Bind.html#TcFunBind"><span class="hs-identifier hs-var">TcFunBind</span></a></span><span> </span><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681097830"><span class="hs-identifier hs-var">mono_info</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681097839"><span class="hs-identifier hs-var">nm_loc</span></a></span><span> </span><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097837"><span class="hs-identifier hs-var">matches</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1379"></span><span>
</span><span id="line-1380"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcLhs"><span class="hs-identifier hs-var">tcLhs</span></a></span><span> </span><span id="local-6989586621681097829"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681097829"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span> </span><span id="local-6989586621681097828"><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097828"><span class="hs-identifier hs-var">no_gen</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#PatBind"><span class="hs-identifier hs-type">PatBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pat_lhs :: forall idL idR. HsBindLR idL idR -&gt; LPat idL
</span><a href="GHC.Hs.Binds.html#pat_lhs"><span class="hs-identifier hs-var">pat_lhs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097826"><span class="annot"><span class="annottext">LPat (GhcPass 'Renamed)
</span><a href="#local-6989586621681097826"><span class="hs-identifier hs-var">pat</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_rhs :: forall idL idR. HsBindLR idL idR -&gt; GRHSs idR (LHsExpr idR)
</span><a href="GHC.Hs.Binds.html#pat_rhs"><span class="hs-identifier hs-var">pat_rhs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097824"><span class="annot"><span class="annottext">GRHSs (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097824"><span class="hs-identifier hs-var">grhss</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1381"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- See Note [Typechecking pattern bindings]</span><span>
</span><span id="line-1382"></span><span>    </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681097823"><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097823"><span class="hs-identifier hs-var">sig_mbis</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">((Name, TcIdSigInfo) -&gt; TcM MonoBindInfo)
-&gt; [(Name, TcIdSigInfo)]
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [MonoBindInfo]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LetBndrSpec -&gt; (Name, TcIdSigInfo) -&gt; TcM MonoBindInfo
</span><a href="GHC.Tc.Gen.Bind.html#tcLhsSigId"><span class="hs-identifier hs-var">tcLhsSigId</span></a></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097828"><span class="hs-identifier hs-var">no_gen</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[(Name, TcIdSigInfo)]
</span><a href="#local-6989586621681097822"><span class="hs-identifier hs-var">sig_names</span></a></span><span>
</span><span id="line-1383"></span><span>
</span><span id="line-1384"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097821"><span class="annot"><span class="annottext">inst_sig_fun :: Name -&gt; Maybe TcId
</span><a href="#local-6989586621681097821"><span class="hs-identifier hs-var hs-var">inst_sig_fun</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameEnv TcId -&gt; Name -&gt; Maybe TcId
forall a. NameEnv a -&gt; Name -&gt; Maybe a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv"><span class="hs-identifier hs-var">lookupNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">(NameEnv TcId -&gt; Name -&gt; Maybe TcId)
-&gt; NameEnv TcId -&gt; Name -&gt; Maybe TcId
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, TcId)] -&gt; NameEnv TcId
forall a. [(Name, a)] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#mkNameEnv"><span class="hs-identifier hs-var">mkNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">([(Name, TcId)] -&gt; NameEnv TcId) -&gt; [(Name, TcId)] -&gt; NameEnv TcId
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1385"></span><span>                             </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MonoBindInfo -&gt; Name
</span><a href="GHC.Tc.Gen.Bind.html#mbi_poly_name"><span class="hs-identifier hs-var hs-var">mbi_poly_name</span></a></span><span> </span><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681097820"><span class="hs-identifier hs-var">mbi</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">MonoBindInfo -&gt; TcId
</span><a href="GHC.Tc.Gen.Bind.html#mbi_mono_id"><span class="hs-identifier hs-var hs-var">mbi_mono_id</span></a></span><span> </span><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681097820"><span class="hs-identifier hs-var">mbi</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1386"></span><span>                             </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681097820"><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681097820"><span class="hs-identifier hs-var">mbi</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097823"><span class="hs-identifier hs-var">sig_mbis</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1387"></span><span>
</span><span id="line-1388"></span><span>            </span><span class="hs-comment">-- See Note [Existentials in pattern bindings]</span><span>
</span><span id="line-1389"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span id="local-6989586621681097819"><span class="annot"><span class="annottext">Located (Pat (GhcPass 'Typechecked))
</span><a href="#local-6989586621681097819"><span class="hs-identifier hs-var">pat'</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097818"><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097818"><span class="hs-identifier hs-var">nosig_mbis</span></a></span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097817"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097817"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1390"></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SDoc
-&gt; TcM
     ((Located (Pat (GhcPass 'Typechecked)), [MonoBindInfo]), Kind)
-&gt; TcM
     ((Located (Pat (GhcPass 'Typechecked)), [MonoBindInfo]), Kind)
forall a. SDoc -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#addErrCtxt"><span class="hs-identifier hs-var">addErrCtxt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LPat (GhcPass 'Renamed)
-&gt; GRHSs (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed)) -&gt; SDoc
forall (p :: Pass) body.
(OutputableBndrId p, Outputable body) =&gt;
LPat (GhcPass p) -&gt; GRHSs (GhcPass 'Renamed) body -&gt; SDoc
</span><a href="GHC.Tc.Gen.Bind.html#patMonoBindsCtxt"><span class="hs-identifier hs-var">patMonoBindsCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Renamed)
</span><a href="#local-6989586621681097826"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">GRHSs (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097824"><span class="hs-identifier hs-var">grhss</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcM ((Located (Pat (GhcPass 'Typechecked)), [MonoBindInfo]), Kind)
 -&gt; TcM
      ((Located (Pat (GhcPass 'Typechecked)), [MonoBindInfo]), Kind))
-&gt; TcM
     ((Located (Pat (GhcPass 'Typechecked)), [MonoBindInfo]), Kind)
-&gt; TcM
     ((Located (Pat (GhcPass 'Typechecked)), [MonoBindInfo]), Kind)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1391"></span><span>               </span><span class="annot"><span class="annottext">(ExpSigmaType
 -&gt; TcM (Located (Pat (GhcPass 'Typechecked)), [MonoBindInfo]))
-&gt; TcM
     ((Located (Pat (GhcPass 'Typechecked)), [MonoBindInfo]), Kind)
forall a. (ExpSigmaType -&gt; TcM a) -&gt; TcM (a, Kind)
</span><a href="GHC.Tc.Utils.TcMType.html#tcInfer"><span class="hs-identifier hs-var">tcInfer</span></a></span><span> </span><span class="annot"><span class="annottext">((ExpSigmaType
  -&gt; TcM (Located (Pat (GhcPass 'Typechecked)), [MonoBindInfo]))
 -&gt; TcM
      ((Located (Pat (GhcPass 'Typechecked)), [MonoBindInfo]), Kind))
-&gt; (ExpSigmaType
    -&gt; TcM (Located (Pat (GhcPass 'Typechecked)), [MonoBindInfo]))
-&gt; TcM
     ((Located (Pat (GhcPass 'Typechecked)), [MonoBindInfo]), Kind)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span> </span><span id="local-6989586621681097815"><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681097815"><span class="hs-identifier hs-var">exp_ty</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-1392"></span><span>               </span><span class="annot"><span class="annottext">(Name -&gt; Maybe TcId)
-&gt; LetBndrSpec
-&gt; LPat (GhcPass 'Renamed)
-&gt; Scaled ExpSigmaType
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [MonoBindInfo]
-&gt; TcM (LPat (GhcPass 'Typechecked), [MonoBindInfo])
forall a.
(Name -&gt; Maybe TcId)
-&gt; LetBndrSpec
-&gt; LPat (GhcPass 'Renamed)
-&gt; Scaled ExpSigmaType
-&gt; TcM a
-&gt; TcM (LPat (GhcPass 'Typechecked), a)
</span><a href="GHC.Tc.Gen.Pat.html#tcLetPat"><span class="hs-identifier hs-var">tcLetPat</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Maybe TcId
</span><a href="#local-6989586621681097821"><span class="hs-identifier hs-var">inst_sig_fun</span></a></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097828"><span class="hs-identifier hs-var">no_gen</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Renamed)
</span><a href="#local-6989586621681097826"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ExpSigmaType -&gt; Scaled ExpSigmaType
forall a. a -&gt; Scaled a
</span><a href="GHC.Core.Type.html#unrestricted"><span class="hs-identifier hs-var">unrestricted</span></a></span><span> </span><span class="annot"><span class="annottext">ExpSigmaType
</span><a href="#local-6989586621681097815"><span class="hs-identifier hs-var">exp_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env TcGblEnv TcLclEnv) [MonoBindInfo]
 -&gt; TcM (LPat (GhcPass 'Typechecked), [MonoBindInfo]))
-&gt; IOEnv (Env TcGblEnv TcLclEnv) [MonoBindInfo]
-&gt; TcM (LPat (GhcPass 'Typechecked), [MonoBindInfo])
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1393"></span><span>                 </span><span class="hs-comment">-- The above inferred type get an unrestricted multiplicity. It may be</span><span>
</span><span id="line-1394"></span><span>                 </span><span class="hs-comment">-- worth it to try and find a finer-grained multiplicity here</span><span>
</span><span id="line-1395"></span><span>                 </span><span class="hs-comment">-- if examples warrant it.</span><span>
</span><span id="line-1396"></span><span>               </span><span class="annot"><span class="annottext">(Name -&gt; TcM MonoBindInfo)
-&gt; [Name] -&gt; IOEnv (Env TcGblEnv TcLclEnv) [MonoBindInfo]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; TcM MonoBindInfo
</span><a href="#local-6989586621681097812"><span class="hs-identifier hs-var">lookup_info</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681097811"><span class="hs-identifier hs-var">nosig_names</span></a></span><span>
</span><span id="line-1397"></span><span>
</span><span id="line-1398"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097810"><span class="annot"><span class="annottext">mbis :: [MonoBindInfo]
</span><a href="#local-6989586621681097810"><span class="hs-identifier hs-var hs-var">mbis</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097823"><span class="hs-identifier hs-var">sig_mbis</span></a></span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo] -&gt; [MonoBindInfo] -&gt; [MonoBindInfo]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097818"><span class="hs-identifier hs-var">nosig_mbis</span></a></span><span>
</span><span id="line-1399"></span><span>
</span><span id="line-1400"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcLhs&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">TcId -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097809"><span class="hs-identifier hs-var">id</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="GHC.Utils.Outputable.html#dcolon"><span class="hs-identifier hs-var">dcolon</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097809"><span class="hs-identifier hs-var">id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1401"></span><span>                                </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681097808"><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681097808"><span class="hs-identifier hs-var">mbi</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097810"><span class="hs-identifier hs-var">mbis</span></a></span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097809"><span class="annot"><span class="annottext">id :: TcId
</span><a href="#local-6989586621681097809"><span class="hs-identifier hs-var hs-var">id</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MonoBindInfo -&gt; TcId
</span><a href="GHC.Tc.Gen.Bind.html#mbi_mono_id"><span class="hs-identifier hs-var hs-var">mbi_mono_id</span></a></span><span> </span><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681097808"><span class="hs-identifier hs-var">mbi</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1402"></span><span>                           </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097828"><span class="hs-identifier hs-var">no_gen</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1403"></span><span>
</span><span id="line-1404"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">TcMonoBind -&gt; TcM TcMonoBind
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[MonoBindInfo]
-&gt; LPat (GhcPass 'Typechecked)
-&gt; GRHSs (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
-&gt; Kind
-&gt; TcMonoBind
</span><a href="GHC.Tc.Gen.Bind.html#TcPatBind"><span class="hs-identifier hs-var">TcPatBind</span></a></span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097810"><span class="hs-identifier hs-var">mbis</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat (GhcPass 'Typechecked))
LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681097819"><span class="hs-identifier hs-var">pat'</span></a></span><span> </span><span class="annot"><span class="annottext">GRHSs (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097824"><span class="hs-identifier hs-var">grhss</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097817"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1405"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1406"></span><span>    </span><span id="local-6989586621681097807"><span class="annot"><span class="annottext">bndr_names :: [IdP (GhcPass 'Renamed)]
</span><a href="#local-6989586621681097807"><span class="hs-identifier hs-var hs-var">bndr_names</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Renamed) -&gt; [IdP (GhcPass 'Renamed)]
forall p. CollectPass p =&gt; LPat p -&gt; [IdP p]
</span><a href="GHC.Hs.Utils.html#collectPatBinders"><span class="hs-identifier hs-var">collectPatBinders</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Renamed)
</span><a href="#local-6989586621681097826"><span class="hs-identifier hs-var">pat</span></a></span><span>
</span><span id="line-1407"></span><span>    </span><span class="hs-special">(</span><span id="local-6989586621681097811"><span class="annot"><span class="annottext">[Name]
</span><a href="#local-6989586621681097811"><span class="hs-identifier hs-var">nosig_names</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097822"><span class="annot"><span class="annottext">[(Name, TcIdSigInfo)]
</span><a href="#local-6989586621681097822"><span class="hs-identifier hs-var">sig_names</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Either Name (Name, TcIdSigInfo))
-&gt; [Name] -&gt; ([Name], [(Name, TcIdSigInfo)])
forall a b c. (a -&gt; Either b c) -&gt; [a] -&gt; ([b], [c])
</span><a href="GHC.Utils.Misc.html#partitionWith"><span class="hs-identifier hs-var">partitionWith</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Either Name (Name, TcIdSigInfo)
</span><a href="#local-6989586621681097804"><span class="hs-identifier hs-var">find_sig</span></a></span><span> </span><span class="annot"><span class="annottext">[Name]
[IdP (GhcPass 'Renamed)]
</span><a href="#local-6989586621681097807"><span class="hs-identifier hs-var">bndr_names</span></a></span><span>
</span><span id="line-1408"></span><span>
</span><span id="line-1409"></span><span>    </span><span class="annot"><a href="#local-6989586621681097804"><span class="hs-identifier hs-type">find_sig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInfo"><span class="hs-identifier hs-type">TcIdSigInfo</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1410"></span><span>    </span><span id="local-6989586621681097804"><span class="annot"><span class="annottext">find_sig :: Name -&gt; Either Name (Name, TcIdSigInfo)
</span><a href="#local-6989586621681097804"><span class="hs-identifier hs-var hs-var">find_sig</span></a></span></span><span> </span><span id="local-6989586621681097803"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097803"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681097829"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097803"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1411"></span><span>                      </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSig"><span class="hs-identifier hs-type">TcIdSig</span></a></span><span> </span><span id="local-6989586621681097802"><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097802"><span class="hs-identifier hs-var">sig</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(Name, TcIdSigInfo) -&gt; Either Name (Name, TcIdSigInfo)
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097803"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097802"><span class="hs-identifier hs-var">sig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1412"></span><span>                      </span><span class="annot"><span class="annottext">Maybe TcSigInfo
</span><span class="hs-identifier">_</span></span><span>                  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Either Name (Name, TcIdSigInfo)
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097803"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1413"></span><span>
</span><span id="line-1414"></span><span>      </span><span class="hs-comment">-- After typechecking the pattern, look up the binder</span><span>
</span><span id="line-1415"></span><span>      </span><span class="hs-comment">-- names that lack a signature, which the pattern has brought</span><span>
</span><span id="line-1416"></span><span>      </span><span class="hs-comment">-- into scope.</span><span>
</span><span id="line-1417"></span><span>    </span><span class="annot"><a href="#local-6989586621681097812"><span class="hs-identifier hs-type">lookup_info</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MonoBindInfo"><span class="hs-identifier hs-type">MonoBindInfo</span></a></span><span>
</span><span id="line-1418"></span><span>    </span><span id="local-6989586621681097812"><span class="annot"><span class="annottext">lookup_info :: Name -&gt; TcM MonoBindInfo
</span><a href="#local-6989586621681097812"><span class="hs-identifier hs-var hs-var">lookup_info</span></a></span></span><span> </span><span id="local-6989586621681097801"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097801"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-1419"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681097800"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097800"><span class="hs-identifier hs-var">mono_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Name -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="GHC.Tc.Utils.Env.html#tcLookupId"><span class="hs-identifier hs-var">tcLookupId</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097801"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1420"></span><span>           </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">MonoBindInfo -&gt; TcM MonoBindInfo
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MBI :: Name -&gt; Maybe TcIdSigInst -&gt; TcId -&gt; MonoBindInfo
</span><a href="GHC.Tc.Gen.Bind.html#MBI"><span class="hs-identifier hs-type">MBI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mbi_poly_name :: Name
</span><a href="GHC.Tc.Gen.Bind.html#mbi_poly_name"><span class="hs-identifier hs-var">mbi_poly_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097801"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1421"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_sig :: Maybe TcIdSigInst
</span><a href="GHC.Tc.Gen.Bind.html#mbi_sig"><span class="hs-identifier hs-var">mbi_sig</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1422"></span><span>                         </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_mono_id :: TcId
</span><a href="GHC.Tc.Gen.Bind.html#mbi_mono_id"><span class="hs-identifier hs-var">mbi_mono_id</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097800"><span class="hs-identifier hs-var">mono_id</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1423"></span><span>
</span><span id="line-1424"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcLhs"><span class="hs-identifier hs-var">tcLhs</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681097798"><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681097798"><span class="hs-identifier hs-var">other_bind</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcM TcMonoBind
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcLhs&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed) -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681097798"><span class="hs-identifier hs-var">other_bind</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1425"></span><span>        </span><span class="hs-comment">-- AbsBind, VarBind impossible</span><span>
</span><span id="line-1426"></span><span>
</span><span id="line-1427"></span><span class="hs-comment">-------------------</span><span>
</span><span id="line-1428"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcLhsSigId"><span class="hs-identifier hs-type">tcLhsSigId</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetBndrSpec"><span class="hs-identifier hs-type">LetBndrSpec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInfo"><span class="hs-identifier hs-type">TcIdSigInfo</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MonoBindInfo"><span class="hs-identifier hs-type">MonoBindInfo</span></a></span><span>
</span><span id="line-1429"></span><span id="tcLhsSigId"><span class="annot"><span class="annottext">tcLhsSigId :: LetBndrSpec -&gt; (Name, TcIdSigInfo) -&gt; TcM MonoBindInfo
</span><a href="GHC.Tc.Gen.Bind.html#tcLhsSigId"><span class="hs-identifier hs-var hs-var">tcLhsSigId</span></a></span></span><span> </span><span id="local-6989586621681097797"><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097797"><span class="hs-identifier hs-var">no_gen</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681097796"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097796"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097795"><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097795"><span class="hs-identifier hs-var">sig</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1430"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681097794"><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097794"><span class="hs-identifier hs-var">inst_sig</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo -&gt; TcM TcIdSigInst
</span><a href="GHC.Tc.Gen.Sig.html#tcInstSig"><span class="hs-identifier hs-var">tcInstSig</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097795"><span class="hs-identifier hs-var">sig</span></a></span><span>
</span><span id="line-1431"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681097792"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097792"><span class="hs-identifier hs-var">mono_id</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
-&gt; Name -&gt; TcIdSigInst -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="GHC.Tc.Gen.Bind.html#newSigLetBndr"><span class="hs-identifier hs-var">newSigLetBndr</span></a></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097797"><span class="hs-identifier hs-var">no_gen</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097796"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097794"><span class="hs-identifier hs-var">inst_sig</span></a></span><span>
</span><span id="line-1432"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">MonoBindInfo -&gt; TcM MonoBindInfo
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">MBI :: Name -&gt; Maybe TcIdSigInst -&gt; TcId -&gt; MonoBindInfo
</span><a href="GHC.Tc.Gen.Bind.html#MBI"><span class="hs-identifier hs-type">MBI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mbi_poly_name :: Name
</span><a href="GHC.Tc.Gen.Bind.html#mbi_poly_name"><span class="hs-identifier hs-var">mbi_poly_name</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097796"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1433"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_sig :: Maybe TcIdSigInst
</span><a href="GHC.Tc.Gen.Bind.html#mbi_sig"><span class="hs-identifier hs-var">mbi_sig</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcIdSigInst -&gt; Maybe TcIdSigInst
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097794"><span class="hs-identifier hs-var">inst_sig</span></a></span><span>
</span><span id="line-1434"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_mono_id :: TcId
</span><a href="GHC.Tc.Gen.Bind.html#mbi_mono_id"><span class="hs-identifier hs-var">mbi_mono_id</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097792"><span class="hs-identifier hs-var">mono_id</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1435"></span><span>
</span><span id="line-1436"></span><span class="hs-comment">------------</span><span>
</span><span id="line-1437"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#newSigLetBndr"><span class="hs-identifier hs-type">newSigLetBndr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetBndrSpec"><span class="hs-identifier hs-type">LetBndrSpec</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInst"><span class="hs-identifier hs-type">TcIdSigInst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcId"><span class="hs-identifier hs-type">TcId</span></a></span><span>
</span><span id="line-1438"></span><span id="newSigLetBndr"><span class="annot"><span class="annottext">newSigLetBndr :: LetBndrSpec
-&gt; Name -&gt; TcIdSigInst -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="GHC.Tc.Gen.Bind.html#newSigLetBndr"><span class="hs-identifier hs-var hs-var">newSigLetBndr</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Pat.html#LetGblBndr"><span class="hs-identifier hs-type">LetGblBndr</span></a></span><span> </span><span id="local-6989586621681097790"><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681097790"><span class="hs-identifier hs-var">prags</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681097789"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097789"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TISI"><span class="hs-identifier hs-type">TISI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sig_inst_sig :: TcIdSigInst -&gt; TcIdSigInfo
</span><a href="GHC.Tc.Types.html#sig_inst_sig"><span class="hs-identifier hs-var">sig_inst_sig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097788"><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097788"><span class="hs-identifier hs-var">id_sig</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1439"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#CompleteSig"><span class="hs-identifier hs-type">CompleteSig</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sig_bndr :: TcIdSigInfo -&gt; TcId
</span><a href="GHC.Tc.Types.html#sig_bndr"><span class="hs-identifier hs-var">sig_bndr</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097787"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097787"><span class="hs-identifier hs-var">poly_id</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097788"><span class="hs-identifier hs-var">id_sig</span></a></span><span>
</span><span id="line-1440"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcId
-&gt; [LSig (GhcPass 'Renamed)] -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="GHC.Tc.Gen.Sig.html#addInlinePrags"><span class="hs-identifier hs-var">addInlinePrags</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097787"><span class="hs-identifier hs-var">poly_id</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcPragEnv -&gt; Name -&gt; [LSig (GhcPass 'Renamed)]
</span><a href="GHC.Tc.Gen.Sig.html#lookupPragEnv"><span class="hs-identifier hs-var">lookupPragEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcPragEnv
</span><a href="#local-6989586621681097790"><span class="hs-identifier hs-var">prags</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097789"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1441"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#newSigLetBndr"><span class="hs-identifier hs-var">newSigLetBndr</span></a></span><span> </span><span id="local-6989586621681097786"><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097786"><span class="hs-identifier hs-var">no_gen</span></a></span></span><span> </span><span id="local-6989586621681097785"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097785"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TISI"><span class="hs-identifier hs-type">TISI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sig_inst_tau :: TcIdSigInst -&gt; Kind
</span><a href="GHC.Tc.Types.html#sig_inst_tau"><span class="hs-identifier hs-var">sig_inst_tau</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097783"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097783"><span class="hs-identifier hs-var">tau</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1442"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
-&gt; Name -&gt; Kind -&gt; Kind -&gt; IOEnv (Env TcGblEnv TcLclEnv) TcId
</span><a href="GHC.Tc.Gen.Pat.html#newLetBndr"><span class="hs-identifier hs-var">newLetBndr</span></a></span><span> </span><span class="annot"><span class="annottext">LetBndrSpec
</span><a href="#local-6989586621681097786"><span class="hs-identifier hs-var">no_gen</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097785"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097783"><span class="hs-identifier hs-var">tau</span></a></span><span>
</span><span id="line-1443"></span><span>    </span><span class="hs-comment">-- Binders with a signature are currently always of multiplicity</span><span>
</span><span id="line-1444"></span><span>    </span><span class="hs-comment">-- Many. Because they come either from toplevel, let, or where</span><span>
</span><span id="line-1445"></span><span>    </span><span class="hs-comment">-- declarations. Which are all unrestricted currently.</span><span>
</span><span id="line-1446"></span><span>
</span><span id="line-1447"></span><span class="hs-comment">-------------------</span><span>
</span><span id="line-1448"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcRhs"><span class="hs-identifier hs-type">tcRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#TcMonoBind"><span class="hs-identifier hs-type">TcMonoBind</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#HsBind"><span class="hs-identifier hs-type">HsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcTc"><span class="hs-identifier hs-type">GhcTc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1449"></span><span id="tcRhs"><span class="annot"><span class="annottext">tcRhs :: TcMonoBind
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
</span><a href="GHC.Tc.Gen.Bind.html#tcRhs"><span class="hs-identifier hs-var hs-var">tcRhs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#TcFunBind"><span class="hs-identifier hs-type">TcFunBind</span></a></span><span> </span><span id="local-6989586621681097782"><span class="annot"><span class="annottext">info :: MonoBindInfo
</span><a href="#local-6989586621681097782"><span class="hs-identifier hs-var">info</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MBI"><span class="hs-identifier hs-type">MBI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mbi_sig :: MonoBindInfo -&gt; Maybe TcIdSigInst
</span><a href="GHC.Tc.Gen.Bind.html#mbi_sig"><span class="hs-identifier hs-var">mbi_sig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097781"><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681097781"><span class="hs-identifier hs-var">mb_sig</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">mbi_mono_id :: MonoBindInfo -&gt; TcId
</span><a href="GHC.Tc.Gen.Bind.html#mbi_mono_id"><span class="hs-identifier hs-var">mbi_mono_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097780"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097780"><span class="hs-identifier hs-var">mono_id</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1450"></span><span>                 </span><span id="local-6989586621681097779"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681097779"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621681097778"><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097778"><span class="hs-identifier hs-var">matches</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1451"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall a. [MonoBindInfo] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Gen.Bind.html#tcExtendIdBinderStackForRhs"><span class="hs-identifier hs-var">tcExtendIdBinderStackForRhs</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681097782"><span class="hs-identifier hs-var">info</span></a></span><span class="hs-special">]</span><span>  </span><span class="annot"><span class="annottext">(TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
 -&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)))
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1452"></span><span>    </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall a. Maybe TcIdSigInst -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Gen.Bind.html#tcExtendTyVarEnvForRhs"><span class="hs-identifier hs-var">tcExtendTyVarEnvForRhs</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="#local-6989586621681097781"><span class="hs-identifier hs-var">mb_sig</span></a></span><span>       </span><span class="annot"><span class="annottext">(TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
 -&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)))
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1453"></span><span>    </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcRhs: fun bind&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097780"><span class="hs-identifier hs-var">mono_id</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097780"><span class="hs-identifier hs-var">mono_id</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1454"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681097775"><span class="annot"><span class="annottext">HsWrapper
</span><a href="#local-6989586621681097775"><span class="hs-identifier hs-var">co_fn</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097774"><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681097774"><span class="hs-identifier hs-var">matches'</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Located Name
-&gt; MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
-&gt; ExpSigmaType
-&gt; TcM
     (HsWrapper,
      MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
</span><a href="GHC.Tc.Gen.Match.html#tcMatchesFun"><span class="hs-identifier hs-var">tcMatchesFun</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; Name -&gt; Located Name
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681097779"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcId -&gt; Name
</span><a href="GHC.Types.Id.html#idName"><span class="hs-identifier hs-var">idName</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097780"><span class="hs-identifier hs-var">mono_id</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-1455"></span><span>                                 </span><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097778"><span class="hs-identifier hs-var">matches</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Kind -&gt; ExpSigmaType
</span><a href="GHC.Tc.Utils.TcType.html#mkCheckExpType"><span class="hs-identifier hs-var">mkCheckExpType</span></a></span><span> </span><span class="annot"><span class="annottext">(Kind -&gt; ExpSigmaType) -&gt; Kind -&gt; ExpSigmaType
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">TcId -&gt; Kind
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097780"><span class="hs-identifier hs-var">mono_id</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1456"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">FunBind :: forall idL idR.
XFunBind idL idR
-&gt; Located (IdP idL)
-&gt; MatchGroup idR (LHsExpr idR)
-&gt; [Tickish TcId]
-&gt; HsBindLR idL idR
</span><a href="GHC.Hs.Binds.html#FunBind"><span class="hs-identifier hs-type">FunBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">fun_id :: Located (IdP (GhcPass 'Typechecked))
</span><a href="GHC.Hs.Binds.html#fun_id"><span class="hs-identifier hs-var">fun_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; TcId -&gt; GenLocated SrcSpan TcId
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621681097779"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097780"><span class="hs-identifier hs-var">mono_id</span></a></span><span>
</span><span id="line-1457"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fun_matches :: MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Hs.Binds.html#fun_matches"><span class="hs-identifier hs-var">fun_matches</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681097774"><span class="hs-identifier hs-var">matches'</span></a></span><span>
</span><span id="line-1458"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fun_ext :: XFunBind (GhcPass 'Typechecked) (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#fun_ext"><span class="hs-identifier hs-var">fun_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">XFunBind (GhcPass 'Typechecked) (GhcPass 'Typechecked)
HsWrapper
</span><a href="#local-6989586621681097775"><span class="hs-identifier hs-var">co_fn</span></a></span><span>
</span><span id="line-1459"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fun_tick :: [Tickish TcId]
</span><a href="GHC.Hs.Binds.html#fun_tick"><span class="hs-identifier hs-var">fun_tick</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-1460"></span><span>
</span><span id="line-1461"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcRhs"><span class="hs-identifier hs-var">tcRhs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#TcPatBind"><span class="hs-identifier hs-type">TcPatBind</span></a></span><span> </span><span id="local-6989586621681097773"><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097773"><span class="hs-identifier hs-var">infos</span></a></span></span><span> </span><span id="local-6989586621681097772"><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681097772"><span class="hs-identifier hs-var">pat'</span></a></span></span><span> </span><span id="local-6989586621681097771"><span class="annot"><span class="annottext">GRHSs (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097771"><span class="hs-identifier hs-var">grhss</span></a></span></span><span> </span><span id="local-6989586621681097770"><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097770"><span class="hs-identifier hs-var">pat_ty</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-1462"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-comment">-- When we are doing pattern bindings we *don't* bring any scoped</span><span>
</span><span id="line-1463"></span><span>    </span><span class="hs-comment">-- type variables into scope unlike function bindings</span><span>
</span><span id="line-1464"></span><span>    </span><span class="hs-comment">-- Wny not?  They are not completely rigid.</span><span>
</span><span id="line-1465"></span><span>    </span><span class="hs-comment">-- That's why we have the special case for a single FunBind in tcMonoBinds</span><span>
</span><span id="line-1466"></span><span>    </span><span class="annot"><span class="annottext">[MonoBindInfo]
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall a. [MonoBindInfo] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Gen.Bind.html#tcExtendIdBinderStackForRhs"><span class="hs-identifier hs-var">tcExtendIdBinderStackForRhs</span></a></span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097773"><span class="hs-identifier hs-var">infos</span></a></span><span>        </span><span class="annot"><span class="annottext">(TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
 -&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)))
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1467"></span><span>    </span><span class="hs-keyword">do</span><span>  </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; TcRn ()
</span><a href="GHC.Tc.Utils.Monad.html#traceTc"><span class="hs-identifier hs-var">traceTc</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;tcRhs: pat bind&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located (Pat (GhcPass 'Typechecked)) -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Located (Pat (GhcPass 'Typechecked))
LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681097772"><span class="hs-identifier hs-var">pat'</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span> </span><span class="annot"><span class="annottext">Kind -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097770"><span class="hs-identifier hs-var">pat_ty</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1468"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681097769"><span class="annot"><span class="annottext">GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681097769"><span class="hs-identifier hs-var">grhss'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">SDoc
-&gt; TcM
     (GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
-&gt; TcM
     (GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
forall a. SDoc -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#addErrCtxt"><span class="hs-identifier hs-var">addErrCtxt</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
-&gt; GRHSs (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed)) -&gt; SDoc
forall (p :: Pass) body.
(OutputableBndrId p, Outputable body) =&gt;
LPat (GhcPass p) -&gt; GRHSs (GhcPass 'Renamed) body -&gt; SDoc
</span><a href="GHC.Tc.Gen.Bind.html#patMonoBindsCtxt"><span class="hs-identifier hs-var">patMonoBindsCtxt</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681097772"><span class="hs-identifier hs-var">pat'</span></a></span><span> </span><span class="annot"><span class="annottext">GRHSs (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097771"><span class="hs-identifier hs-var">grhss</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcM
   (GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
 -&gt; TcM
      (GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
-&gt; TcM
     (GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
-&gt; TcM
     (GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1469"></span><span>                    </span><span class="annot"><span class="annottext">Kind
-&gt; TcM
     (GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
-&gt; TcM
     (GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
forall a. Kind -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Monad.html#tcScalingUsage"><span class="hs-identifier hs-var">tcScalingUsage</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="GHC.Core.Type.html#Many"><span class="hs-identifier hs-var">Many</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM
   (GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
 -&gt; TcM
      (GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))))
-&gt; TcM
     (GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
-&gt; TcM
     (GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1470"></span><span>                    </span><span class="hs-comment">-- Like in tcMatchesFun, this scaling happens because all</span><span>
</span><span id="line-1471"></span><span>                    </span><span class="hs-comment">-- let bindings are unrestricted. A difference, here, is</span><span>
</span><span id="line-1472"></span><span>                    </span><span class="hs-comment">-- that when this is not the case, any more, we will have to</span><span>
</span><span id="line-1473"></span><span>                    </span><span class="hs-comment">-- make sure that the pattern is strict, otherwise this will</span><span>
</span><span id="line-1474"></span><span>                    </span><span class="hs-comment">-- be desugar to incorrect code.</span><span>
</span><span id="line-1475"></span><span>                    </span><span class="annot"><span class="annottext">GRHSs (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
-&gt; Kind
-&gt; TcM
     (GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked)))
</span><a href="GHC.Tc.Gen.Match.html#tcGRHSsPat"><span class="hs-identifier hs-var">tcGRHSsPat</span></a></span><span> </span><span class="annot"><span class="annottext">GRHSs (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097771"><span class="hs-identifier hs-var">grhss</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097770"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-1476"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked)
-&gt; TcM (HsBindLR (GhcPass 'Typechecked) (GhcPass 'Typechecked))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><span class="annottext">PatBind :: forall idL idR.
XPatBind idL idR
-&gt; LPat idL
-&gt; GRHSs idR (LHsExpr idR)
-&gt; ([Tickish TcId], [[Tickish TcId]])
-&gt; HsBindLR idL idR
</span><a href="GHC.Hs.Binds.html#PatBind"><span class="hs-identifier hs-type">PatBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pat_lhs :: LPat (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#pat_lhs"><span class="hs-identifier hs-var">pat_lhs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><a href="#local-6989586621681097772"><span class="hs-identifier hs-var">pat'</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_rhs :: GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="GHC.Hs.Binds.html#pat_rhs"><span class="hs-identifier hs-var">pat_rhs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GRHSs (GhcPass 'Typechecked) (LHsExpr (GhcPass 'Typechecked))
</span><a href="#local-6989586621681097769"><span class="hs-identifier hs-var">grhss'</span></a></span><span>
</span><span id="line-1477"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_ext :: XPatBind (GhcPass 'Typechecked) (GhcPass 'Typechecked)
</span><a href="GHC.Hs.Binds.html#pat_ext"><span class="hs-identifier hs-var">pat_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet Name -&gt; Kind -&gt; NPatBindTc
</span><a href="GHC.Hs.Binds.html#NPatBindTc"><span class="hs-identifier hs-var">NPatBindTc</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet Name
</span><a href="GHC.Types.Name.Set.html#emptyNameSet"><span class="hs-identifier hs-var">emptyNameSet</span></a></span><span> </span><span class="annot"><span class="annottext">Kind
</span><a href="#local-6989586621681097770"><span class="hs-identifier hs-var">pat_ty</span></a></span><span>
</span><span id="line-1478"></span><span>                           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_ticks :: ([Tickish TcId], [[Tickish TcId]])
</span><a href="GHC.Hs.Binds.html#pat_ticks"><span class="hs-identifier hs-var">pat_ticks</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">,</span><span class="hs-special">[</span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">)</span><span class="hs-special">}</span><span>
</span><span id="line-1479"></span><span>
</span><span id="line-1480"></span><span id="local-6989586621681099059"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcExtendTyVarEnvForRhs"><span class="hs-identifier hs-type">tcExtendTyVarEnvForRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInst"><span class="hs-identifier hs-type">TcIdSigInst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099059"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099059"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1481"></span><span id="tcExtendTyVarEnvForRhs"><span class="annot"><span class="annottext">tcExtendTyVarEnvForRhs :: forall a. Maybe TcIdSigInst -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Gen.Bind.html#tcExtendTyVarEnvForRhs"><span class="hs-identifier hs-var hs-var">tcExtendTyVarEnvForRhs</span></a></span></span><span> </span><span class="annot"><span class="annottext">Maybe TcIdSigInst
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span id="local-6989586621681097765"><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681097765"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-1482"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681097765"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-1483"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcExtendTyVarEnvForRhs"><span class="hs-identifier hs-var">tcExtendTyVarEnvForRhs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681097764"><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097764"><span class="hs-identifier hs-var">sig</span></a></span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681097763"><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681097763"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-1484"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">TcIdSigInst -&gt; TcM a -&gt; TcM a
forall a. TcIdSigInst -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Gen.Bind.html#tcExtendTyVarEnvFromSig"><span class="hs-identifier hs-var">tcExtendTyVarEnvFromSig</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097764"><span class="hs-identifier hs-var">sig</span></a></span><span> </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681097763"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-1485"></span><span>
</span><span id="line-1486"></span><span id="local-6989586621681099055"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcExtendTyVarEnvFromSig"><span class="hs-identifier hs-type">tcExtendTyVarEnvFromSig</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInst"><span class="hs-identifier hs-type">TcIdSigInst</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099055"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099055"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1487"></span><span id="tcExtendTyVarEnvFromSig"><span class="annot"><span class="annottext">tcExtendTyVarEnvFromSig :: forall a. TcIdSigInst -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Gen.Bind.html#tcExtendTyVarEnvFromSig"><span class="hs-identifier hs-var hs-var">tcExtendTyVarEnvFromSig</span></a></span></span><span> </span><span id="local-6989586621681097761"><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097761"><span class="hs-identifier hs-var">sig_inst</span></a></span></span><span> </span><span id="local-6989586621681097760"><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681097760"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-1488"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TISI"><span class="hs-identifier hs-type">TISI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">sig_inst_skols :: TcIdSigInst -&gt; [(Name, InvisTVBinder)]
</span><a href="GHC.Tc.Types.html#sig_inst_skols"><span class="hs-identifier hs-var">sig_inst_skols</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097759"><span class="annot"><span class="annottext">[(Name, InvisTVBinder)]
</span><a href="#local-6989586621681097759"><span class="hs-identifier hs-var">skol_prs</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">sig_inst_wcs :: TcIdSigInst -&gt; [(Name, TcId)]
</span><a href="GHC.Tc.Types.html#sig_inst_wcs"><span class="hs-identifier hs-var">sig_inst_wcs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097757"><span class="annot"><span class="annottext">[(Name, TcId)]
</span><a href="#local-6989586621681097757"><span class="hs-identifier hs-var">wcs</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcIdSigInst
</span><a href="#local-6989586621681097761"><span class="hs-identifier hs-var">sig_inst</span></a></span><span>
</span><span id="line-1489"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Name, TcId)] -&gt; TcM a -&gt; TcM a
forall a. [(Name, TcId)] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendNameTyVarEnv"><span class="hs-identifier hs-var">tcExtendNameTyVarEnv</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, TcId)]
</span><a href="#local-6989586621681097757"><span class="hs-identifier hs-var">wcs</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM a -&gt; TcM a) -&gt; TcM a -&gt; TcM a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1490"></span><span>    </span><span class="annot"><span class="annottext">[(Name, TcId)] -&gt; TcM a -&gt; TcM a
forall a. [(Name, TcId)] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendNameTyVarEnv"><span class="hs-identifier hs-var">tcExtendNameTyVarEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(InvisTVBinder -&gt; TcId)
-&gt; [(Name, InvisTVBinder)] -&gt; [(Name, TcId)]
forall b c a. (b -&gt; c) -&gt; [(a, b)] -&gt; [(a, c)]
</span><a href="GHC.Utils.Misc.html#mapSnd"><span class="hs-identifier hs-var">mapSnd</span></a></span><span> </span><span class="annot"><span class="annottext">InvisTVBinder -&gt; TcId
forall tv argf. VarBndr tv argf -&gt; tv
</span><a href="GHC.Types.Var.html#binderVar"><span class="hs-identifier hs-var">binderVar</span></a></span><span> </span><span class="annot"><span class="annottext">[(Name, InvisTVBinder)]
</span><a href="#local-6989586621681097759"><span class="hs-identifier hs-var">skol_prs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(TcM a -&gt; TcM a) -&gt; TcM a -&gt; TcM a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-1491"></span><span>    </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681097760"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-1492"></span><span>
</span><span id="line-1493"></span><span id="local-6989586621681099060"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#tcExtendIdBinderStackForRhs"><span class="hs-identifier hs-type">tcExtendIdBinderStackForRhs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MonoBindInfo"><span class="hs-identifier hs-type">MonoBindInfo</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099060"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcM"><span class="hs-identifier hs-type">TcM</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099060"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-1494"></span><span class="hs-comment">-- See Note [Relevant bindings and the binder stack]</span><span>
</span><span id="line-1495"></span><span id="tcExtendIdBinderStackForRhs"><span class="annot"><span class="annottext">tcExtendIdBinderStackForRhs :: forall a. [MonoBindInfo] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Gen.Bind.html#tcExtendIdBinderStackForRhs"><span class="hs-identifier hs-var hs-var">tcExtendIdBinderStackForRhs</span></a></span></span><span> </span><span id="local-6989586621681097754"><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097754"><span class="hs-identifier hs-var">infos</span></a></span></span><span> </span><span id="local-6989586621681097753"><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681097753"><span class="hs-identifier hs-var">thing_inside</span></a></span></span><span>
</span><span id="line-1496"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[TcBinder] -&gt; TcM a -&gt; TcM a
forall a. [TcBinder] -&gt; TcM a -&gt; TcM a
</span><a href="GHC.Tc.Utils.Env.html#tcExtendBinderStack"><span class="hs-identifier hs-var">tcExtendBinderStack</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">TcId -&gt; TopLevelFlag -&gt; TcBinder
</span><a href="GHC.Tc.Types.html#TcIdBndr"><span class="hs-identifier hs-var">TcIdBndr</span></a></span><span> </span><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097752"><span class="hs-identifier hs-var">mono_id</span></a></span><span> </span><span class="annot"><span class="annottext">TopLevelFlag
</span><a href="GHC.Types.Basic.html#NotTopLevel"><span class="hs-identifier hs-var">NotTopLevel</span></a></span><span>
</span><span id="line-1497"></span><span>                        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MBI"><span class="hs-identifier hs-type">MBI</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">mbi_mono_id :: MonoBindInfo -&gt; TcId
</span><a href="GHC.Tc.Gen.Bind.html#mbi_mono_id"><span class="hs-identifier hs-var">mbi_mono_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097752"><span class="annot"><span class="annottext">TcId
</span><a href="#local-6989586621681097752"><span class="hs-identifier hs-var">mono_id</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097754"><span class="hs-identifier hs-var">infos</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1498"></span><span>                        </span><span class="annot"><span class="annottext">TcM a
</span><a href="#local-6989586621681097753"><span class="hs-identifier hs-var">thing_inside</span></a></span><span>
</span><span id="line-1499"></span><span>    </span><span class="hs-comment">-- NotTopLevel: it's a monomorphic binding</span><span>
</span><span id="line-1500"></span><span>
</span><span id="line-1501"></span><span class="hs-comment">---------------------</span><span>
</span><span id="line-1502"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#getMonoBindInfo"><span class="hs-identifier hs-type">getMonoBindInfo</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#TcMonoBind"><span class="hs-identifier hs-type">TcMonoBind</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#MonoBindInfo"><span class="hs-identifier hs-type">MonoBindInfo</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1503"></span><span id="getMonoBindInfo"><span class="annot"><span class="annottext">getMonoBindInfo :: [Located TcMonoBind] -&gt; [MonoBindInfo]
</span><a href="GHC.Tc.Gen.Bind.html#getMonoBindInfo"><span class="hs-identifier hs-var hs-var">getMonoBindInfo</span></a></span></span><span> </span><span id="local-6989586621681097751"><span class="annot"><span class="annottext">[Located TcMonoBind]
</span><a href="#local-6989586621681097751"><span class="hs-identifier hs-var">tc_binds</span></a></span></span><span>
</span><span id="line-1504"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Located TcMonoBind -&gt; [MonoBindInfo] -&gt; [MonoBindInfo])
-&gt; [MonoBindInfo] -&gt; [Located TcMonoBind] -&gt; [MonoBindInfo]
forall (t :: * -&gt; *) a b.
Foldable t =&gt;
(a -&gt; b -&gt; b) -&gt; b -&gt; t a -&gt; b
</span><a href="../../base/src/Data.Foldable.html#foldr"><span class="hs-identifier hs-var">foldr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcMonoBind -&gt; [MonoBindInfo] -&gt; [MonoBindInfo]
</span><a href="#local-6989586621681097750"><span class="hs-identifier hs-var">get_info</span></a></span><span> </span><span class="annot"><span class="annottext">(TcMonoBind -&gt; [MonoBindInfo] -&gt; [MonoBindInfo])
-&gt; (Located TcMonoBind -&gt; TcMonoBind)
-&gt; Located TcMonoBind
-&gt; [MonoBindInfo]
-&gt; [MonoBindInfo]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Located TcMonoBind -&gt; TcMonoBind
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Located TcMonoBind]
</span><a href="#local-6989586621681097751"><span class="hs-identifier hs-var">tc_binds</span></a></span><span>
</span><span id="line-1505"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1506"></span><span>    </span><span id="local-6989586621681097750"><span class="annot"><span class="annottext">get_info :: TcMonoBind -&gt; [MonoBindInfo] -&gt; [MonoBindInfo]
</span><a href="#local-6989586621681097750"><span class="hs-identifier hs-var hs-var">get_info</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#TcFunBind"><span class="hs-identifier hs-type">TcFunBind</span></a></span><span> </span><span id="local-6989586621681097749"><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681097749"><span class="hs-identifier hs-var">info</span></a></span></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>    </span><span id="local-6989586621681097748"><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097748"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MonoBindInfo
</span><a href="#local-6989586621681097749"><span class="hs-identifier hs-var">info</span></a></span><span> </span><span class="annot"><span class="annottext">MonoBindInfo -&gt; [MonoBindInfo] -&gt; [MonoBindInfo]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097748"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-1507"></span><span>    </span><span class="annot"><a href="#local-6989586621681097750"><span class="hs-identifier hs-var">get_info</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#TcPatBind"><span class="hs-identifier hs-type">TcPatBind</span></a></span><span> </span><span id="local-6989586621681097747"><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097747"><span class="hs-identifier hs-var">infos</span></a></span></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Typechecked)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">GRHSs (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Kind
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span id="local-6989586621681097746"><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097746"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097747"><span class="hs-identifier hs-var">infos</span></a></span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo] -&gt; [MonoBindInfo] -&gt; [MonoBindInfo]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[MonoBindInfo]
</span><a href="#local-6989586621681097746"><span class="hs-identifier hs-var">rest</span></a></span><span>
</span><span id="line-1508"></span><span>
</span><span id="line-1509"></span><span>
</span><span id="line-1510"></span><span class="hs-comment">{- Note [Relevant bindings and the binder stack]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When typecking a binding we extend the TcBinderStack for the RHS of
the binding, with the /monomorphic/ Id.  That way, if we have, say
    f = \x -&gt; blah
and something goes wrong in 'blah', we get a &quot;relevant binding&quot;
looking like  f :: alpha -&gt; beta
This applies if 'f' has a type signature too:
   f :: forall a. [a] -&gt; [a]
   f x = True
We can't unify True with [a], and a relevant binding is f :: [a] -&gt; [a]
If we had the *polymorphic* version of f in the TcBinderStack, it
would not be reported as relevant, because its type is closed.
(See TcErrors.relevantBindings.)

Note [Typechecking pattern bindings]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Look at:
   - typecheck/should_compile/ExPat
   - #12427, typecheck/should_compile/T12427{a,b}

  data T where
    MkT :: Integral a =&gt; a -&gt; Int -&gt; T

and suppose t :: T.  Which of these pattern bindings are ok?

  E1. let { MkT p _ = t } in &lt;body&gt;

  E2. let { MkT _ q = t } in &lt;body&gt;

  E3. let { MkT (toInteger -&gt; r) _ = t } in &lt;body&gt;

* (E1) is clearly wrong because the existential 'a' escapes.
  What type could 'p' possibly have?

* (E2) is fine, despite the existential pattern, because
  q::Int, and nothing escapes.

* Even (E3) is fine.  The existential pattern binds a dictionary
  for (Integral a) which the view pattern can use to convert the
  a-valued field to an Integer, so r :: Integer.

An easy way to see all three is to imagine the desugaring.
For (E2) it would look like
    let q = case t of MkT _ q' -&gt; q'
    in &lt;body&gt;


We typecheck pattern bindings as follows.  First tcLhs does this:

  1. Take each type signature q :: ty, partial or complete, and
     instantiate it (with tcLhsSigId) to get a MonoBindInfo.  This
     gives us a fresh &quot;mono_id&quot; qm :: instantiate(ty), where qm has
     a fresh name.

     Any fresh unification variables in instantiate(ty) born here, not
     deep under implications as would happen if we allocated them when
     we encountered q during tcPat.

  2. Build a little environment mapping &quot;q&quot; -&gt; &quot;qm&quot; for those Ids
     with signatures (inst_sig_fun)

  3. Invoke tcLetPat to typecheck the pattern.

     - We pass in the current TcLevel.  This is captured by
       GHC.Tc.Gen.Pat.tcLetPat, and put into the pc_lvl field of PatCtxt, in
       PatEnv.

     - When tcPat finds an existential constructor, it binds fresh
       type variables and dictionaries as usual, increments the TcLevel,
       and emits an implication constraint.

     - When we come to a binder (GHC.Tc.Gen.Pat.tcPatBndr), it looks it up
       in the little environment (the pc_sig_fn field of PatCtxt).

         Success =&gt; There was a type signature, so just use it,
                    checking compatibility with the expected type.

         Failure =&gt; No type signature.
             Infer case: (happens only outside any constructor pattern)
                         use a unification variable
                         at the outer level pc_lvl

             Check case: use promoteTcType to promote the type
                         to the outer level pc_lvl.  This is the
                         place where we emit a constraint that'll blow
                         up if existential capture takes place

       Result: the type of the binder is always at pc_lvl. This is
       crucial.

  4. Throughout, when we are making up an Id for the pattern-bound variables
     (newLetBndr), we have two cases:

     - If we are generalising (generalisation plan is InferGen or
       CheckGen), then the let_bndr_spec will be LetLclBndr.  In that case
       we want to bind a cloned, local version of the variable, with the
       type given by the pattern context, *not* by the signature (even if
       there is one; see #7268). The mkExport part of the
       generalisation step will do the checking and impedance matching
       against the signature.

     - If for some reason we are not generalising (plan = NoGen), the
       LetBndrSpec will be LetGblBndr.  In that case we must bind the
       global version of the Id, and do so with precisely the type given
       in the signature.  (Then we unify with the type from the pattern
       context type.)


And that's it!  The implication constraints check for the skolem
escape.  It's quite simple and neat, and more expressive than before
e.g. GHC 8.0 rejects (E2) and (E3).

Example for (E1), starting at level 1.  We generate
     p :: beta:1, with constraints (forall:3 a. Integral a =&gt; a ~ beta)
The (a~beta) can't float (because of the 'a'), nor be solved (because
beta is untouchable.)

Example for (E2), we generate
     q :: beta:1, with constraint (forall:3 a. Integral a =&gt; Int ~ beta)
The beta is untouchable, but floats out of the constraint and can
be solved absolutely fine.


************************************************************************
*                                                                      *
                Generalisation
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-1639"></span><span>
</span><span id="line-1640"></span><span class="hs-keyword">data</span><span> </span><span id="GeneralisationPlan"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#GeneralisationPlan"><span class="hs-identifier hs-var">GeneralisationPlan</span></a></span></span><span>
</span><span id="line-1641"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span id="NoGen"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#NoGen"><span class="hs-identifier hs-var">NoGen</span></a></span></span><span>               </span><span class="hs-comment">-- No generalisation, no AbsBinds</span><span>
</span><span id="line-1642"></span><span>
</span><span id="line-1643"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="InferGen"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#InferGen"><span class="hs-identifier hs-var">InferGen</span></a></span></span><span>            </span><span class="hs-comment">-- Implicit generalisation; there is an AbsBinds</span><span>
</span><span id="line-1644"></span><span>       </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>             </span><span class="hs-comment">--   True &lt;=&gt; apply the MR; generalise only unconstrained type vars</span><span>
</span><span id="line-1645"></span><span>
</span><span id="line-1646"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span id="CheckGen"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#CheckGen"><span class="hs-identifier hs-var">CheckGen</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBind"><span class="hs-identifier hs-type">LHsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSigInfo"><span class="hs-identifier hs-type">TcIdSigInfo</span></a></span><span>
</span><span id="line-1647"></span><span>                        </span><span class="hs-comment">-- One FunBind with a signature</span><span>
</span><span id="line-1648"></span><span>                        </span><span class="hs-comment">-- Explicit generalisation</span><span>
</span><span id="line-1649"></span><span>
</span><span id="line-1650"></span><span class="hs-comment">-- A consequence of the no-AbsBinds choice (NoGen) is that there is</span><span>
</span><span id="line-1651"></span><span class="hs-comment">-- no &quot;polymorphic Id&quot; and &quot;monmomorphic Id&quot;; there is just the one</span><span>
</span><span id="line-1652"></span><span>
</span><span id="line-1653"></span><span class="hs-keyword">instance</span><span> </span><span id="local-6989586621681097743"><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#GeneralisationPlan"><span class="hs-identifier hs-type">GeneralisationPlan</span></a></span></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-1654"></span><span>  </span><span id="local-6989586621681097738"><span class="annot"><span class="annottext">ppr :: GeneralisationPlan -&gt; SDoc
</span><a href="#local-6989586621681097738"><span class="hs-identifier hs-var hs-var hs-var hs-var">ppr</span></a></span></span><span> </span><span class="annot"><span class="annottext">GeneralisationPlan
</span><a href="GHC.Tc.Gen.Bind.html#NoGen"><span class="hs-identifier hs-var">NoGen</span></a></span><span>          </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;NoGen&quot;</span></span><span>
</span><span id="line-1655"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#InferGen"><span class="hs-identifier hs-type">InferGen</span></a></span><span> </span><span id="local-6989586621681097737"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681097737"><span class="hs-identifier hs-var">b</span></a></span></span><span class="hs-special">)</span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;InferGen&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681097737"><span class="hs-identifier hs-var">b</span></a></span><span>
</span><span id="line-1656"></span><span>  </span><span class="annot"><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#CheckGen"><span class="hs-identifier hs-type">CheckGen</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681097736"><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097736"><span class="hs-identifier hs-var">s</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;CheckGen&quot;</span></span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097736"><span class="hs-identifier hs-var">s</span></a></span><span>
</span><span id="line-1657"></span><span>
</span><span id="line-1658"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#decideGeneralisationPlan"><span class="hs-identifier hs-type">decideGeneralisationPlan</span></a></span><span>
</span><span id="line-1659"></span><span>   </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBind"><span class="hs-identifier hs-type">LHsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IsGroupClosed"><span class="hs-identifier hs-type">IsGroupClosed</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcSigFun"><span class="hs-identifier hs-type">TcSigFun</span></a></span><span>
</span><span id="line-1660"></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#GeneralisationPlan"><span class="hs-identifier hs-type">GeneralisationPlan</span></a></span><span>
</span><span id="line-1661"></span><span id="decideGeneralisationPlan"><span class="annot"><span class="annottext">decideGeneralisationPlan :: DynFlags
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; IsGroupClosed
-&gt; TcSigFun
-&gt; GeneralisationPlan
</span><a href="GHC.Tc.Gen.Bind.html#decideGeneralisationPlan"><span class="hs-identifier hs-var hs-var">decideGeneralisationPlan</span></a></span></span><span> </span><span id="local-6989586621681097735"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681097735"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681097734"><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681097734"><span class="hs-identifier hs-var">lbinds</span></a></span></span><span> </span><span id="local-6989586621681097733"><span class="annot"><span class="annottext">IsGroupClosed
</span><a href="#local-6989586621681097733"><span class="hs-identifier hs-var">closed</span></a></span></span><span> </span><span id="local-6989586621681097732"><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681097732"><span class="hs-identifier hs-var">sig_fn</span></a></span></span><span>
</span><span id="line-1662"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681097731"><span class="hs-identifier hs-var">has_partial_sigs</span></a></span><span>                         </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; GeneralisationPlan
</span><a href="GHC.Tc.Gen.Bind.html#InferGen"><span class="hs-identifier hs-var">InferGen</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Bool] -&gt; Bool
forall (t :: * -&gt; *). Foldable t =&gt; t Bool -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#and"><span class="hs-identifier hs-var">and</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621681097729"><span class="hs-identifier hs-var">partial_sig_mrs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1663"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681097728"><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681097728"><span class="hs-identifier hs-var">bind</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681097727"><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097727"><span class="hs-identifier hs-var">sig</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Maybe (LHsBind (GhcPass 'Renamed), TcIdSigInfo)
</span><a href="#local-6989586621681097726"><span class="hs-identifier hs-var">one_funbind_with_sig</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed) -&gt; TcIdSigInfo -&gt; GeneralisationPlan
</span><a href="GHC.Tc.Gen.Bind.html#CheckGen"><span class="hs-identifier hs-var">CheckGen</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681097728"><span class="hs-identifier hs-var">bind</span></a></span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097727"><span class="hs-identifier hs-var">sig</span></a></span><span>
</span><span id="line-1664"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">IsGroupClosed -&gt; Bool
</span><a href="#local-6989586621681097725"><span class="hs-identifier hs-var">do_not_generalise</span></a></span><span> </span><span class="annot"><span class="annottext">IsGroupClosed
</span><a href="#local-6989586621681097733"><span class="hs-identifier hs-var">closed</span></a></span><span>                 </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GeneralisationPlan
</span><a href="GHC.Tc.Gen.Bind.html#NoGen"><span class="hs-identifier hs-var">NoGen</span></a></span><span>
</span><span id="line-1665"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>                                </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; GeneralisationPlan
</span><a href="GHC.Tc.Gen.Bind.html#InferGen"><span class="hs-identifier hs-var">InferGen</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681097724"><span class="hs-identifier hs-var">mono_restriction</span></a></span><span>
</span><span id="line-1666"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1667"></span><span>    </span><span id="local-6989586621681097723"><span class="annot"><span class="annottext">binds :: [HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)]
</span><a href="#local-6989586621681097723"><span class="hs-identifier hs-var hs-var">binds</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LHsBind (GhcPass 'Renamed)
 -&gt; HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed))
-&gt; [LHsBind (GhcPass 'Renamed)]
-&gt; [HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
-&gt; HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681097734"><span class="hs-identifier hs-var">lbinds</span></a></span><span>
</span><span id="line-1668"></span><span>
</span><span id="line-1669"></span><span>    </span><span class="annot"><a href="#local-6989586621681097729"><span class="hs-identifier hs-type">partial_sig_mrs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span class="hs-special">]</span><span>
</span><span id="line-1670"></span><span>    </span><span class="hs-comment">-- One for each partial signature (so empty =&gt; no partial sigs)</span><span>
</span><span id="line-1671"></span><span>    </span><span class="hs-comment">-- The Bool is True if the signature has no constraint context</span><span>
</span><span id="line-1672"></span><span>    </span><span class="hs-comment">--      so we should apply the MR</span><span>
</span><span id="line-1673"></span><span>    </span><span class="hs-comment">-- See Note [Partial type signatures and generalisation]</span><span>
</span><span id="line-1674"></span><span>    </span><span id="local-6989586621681097729"><span class="annot"><span class="annottext">partial_sig_mrs :: [Bool]
</span><a href="#local-6989586621681097729"><span class="hs-identifier hs-var hs-var">partial_sig_mrs</span></a></span></span><span>
</span><span id="line-1675"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">[LHsType (GhcPass 'Renamed)] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsType (GhcPass 'Renamed)]
</span><a href="#local-6989586621681097722"><span class="hs-identifier hs-var">theta</span></a></span><span>
</span><span id="line-1676"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSig"><span class="hs-identifier hs-type">TcIdSig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#PartialSig"><span class="hs-identifier hs-type">PartialSig</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">psig_hs_ty :: TcIdSigInfo -&gt; LHsSigWcType (GhcPass 'Renamed)
</span><a href="GHC.Tc.Types.html#psig_hs_ty"><span class="hs-identifier hs-var">psig_hs_ty</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097721"><span class="annot"><span class="annottext">LHsSigWcType (GhcPass 'Renamed)
</span><a href="#local-6989586621681097721"><span class="hs-identifier hs-var">hs_ty</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1677"></span><span>            </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcSigFun -&gt; [Name] -&gt; [TcSigInfo]
forall a b. (a -&gt; Maybe b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/Data.Maybe.html#mapMaybe"><span class="hs-identifier hs-var">mapMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681097732"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)] -&gt; [IdP (GhcPass 'Renamed)]
forall p idR. CollectPass p =&gt; [LHsBindLR p idR] -&gt; [IdP p]
</span><a href="GHC.Hs.Utils.html#collectHsBindListBinders"><span class="hs-identifier hs-var">collectHsBindListBinders</span></a></span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681097734"><span class="hs-identifier hs-var">lbinds</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1678"></span><span>        </span><span class="hs-special">,</span><span> </span><span class="hs-keyword">let</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[LHsTyVarBndr Specificity (GhcPass 'Renamed)]
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681097722"><span class="annot"><span class="annottext">[LHsType (GhcPass 'Renamed)]
</span><a href="#local-6989586621681097722"><span class="hs-identifier hs-var">theta</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">LHsType (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">LHsType (GhcPass 'Renamed)
-&gt; ([LHsTyVarBndr Specificity (GhcPass 'Renamed)],
    GenLocated SrcSpan [LHsType (GhcPass 'Renamed)],
    LHsType (GhcPass 'Renamed))
forall pass.
LHsType pass
-&gt; ([LHsTyVarBndr Specificity pass], LHsContext pass, LHsType pass)
</span><a href="GHC.Hs.Type.html#splitLHsSigmaTyInvis"><span class="hs-identifier hs-var">splitLHsSigmaTyInvis</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsSigWcType (GhcPass 'Renamed) -&gt; LHsType (GhcPass 'Renamed)
forall pass. LHsSigWcType pass -&gt; LHsType pass
</span><a href="GHC.Hs.Type.html#hsSigWcType"><span class="hs-identifier hs-var">hsSigWcType</span></a></span><span> </span><span class="annot"><span class="annottext">LHsSigWcType (GhcPass 'Renamed)
</span><a href="#local-6989586621681097721"><span class="hs-identifier hs-var">hs_ty</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-1679"></span><span>
</span><span id="line-1680"></span><span>    </span><span id="local-6989586621681097731"><span class="annot"><span class="annottext">has_partial_sigs :: Bool
</span><a href="#local-6989586621681097731"><span class="hs-identifier hs-var hs-var">has_partial_sigs</span></a></span></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Bool] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[Bool]
</span><a href="#local-6989586621681097729"><span class="hs-identifier hs-var">partial_sig_mrs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1681"></span><span>
</span><span id="line-1682"></span><span>    </span><span id="local-6989586621681097724"><span class="annot"><span class="annottext">mono_restriction :: Bool
</span><a href="#local-6989586621681097724"><span class="hs-identifier hs-var hs-var">mono_restriction</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Extension -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#xopt"><span class="hs-identifier hs-var">xopt</span></a></span><span> </span><span class="annot"><span class="annottext">Extension
</span><a href="../../ghc-boot-th/src/GHC.LanguageExtensions.Type.html#MonomorphismRestriction"><span class="hs-identifier hs-var">LangExt.MonomorphismRestriction</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681097735"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1683"></span><span>                     </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed) -&gt; Bool)
-&gt; [HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#any"><span class="hs-identifier hs-var">any</span></a></span><span> </span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed) -&gt; Bool
</span><a href="#local-6989586621681097712"><span class="hs-identifier hs-var">restricted</span></a></span><span> </span><span class="annot"><span class="annottext">[HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)]
</span><a href="#local-6989586621681097723"><span class="hs-identifier hs-var">binds</span></a></span><span>
</span><span id="line-1684"></span><span>
</span><span id="line-1685"></span><span>    </span><span id="local-6989586621681097725"><span class="annot"><span class="annottext">do_not_generalise :: IsGroupClosed -&gt; Bool
</span><a href="#local-6989586621681097725"><span class="hs-identifier hs-var hs-var">do_not_generalise</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#IsGroupClosed"><span class="hs-identifier hs-type">IsGroupClosed</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv (UniqSet Name)
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1686"></span><span>        </span><span class="hs-comment">-- The 'True' means that all of the group's</span><span>
</span><span id="line-1687"></span><span>        </span><span class="hs-comment">-- free vars have ClosedTypeId=True; so we can ignore</span><span>
</span><span id="line-1688"></span><span>        </span><span class="hs-comment">-- -XMonoLocalBinds, and generalise anyway</span><span>
</span><span id="line-1689"></span><span>    </span><span class="annot"><a href="#local-6989586621681097725"><span class="hs-identifier hs-var">do_not_generalise</span></a></span><span> </span><span class="annot"><span class="annottext">IsGroupClosed
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Extension -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#xopt"><span class="hs-identifier hs-var">xopt</span></a></span><span> </span><span class="annot"><span class="annottext">Extension
</span><a href="../../ghc-boot-th/src/GHC.LanguageExtensions.Type.html#MonoLocalBinds"><span class="hs-identifier hs-var">LangExt.MonoLocalBinds</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681097735"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-1690"></span><span>
</span><span id="line-1691"></span><span>    </span><span class="hs-comment">-- With OutsideIn, all nested bindings are monomorphic</span><span>
</span><span id="line-1692"></span><span>    </span><span class="hs-comment">-- except a single function binding with a signature</span><span>
</span><span id="line-1693"></span><span>    </span><span id="local-6989586621681097726"><span class="annot"><span class="annottext">one_funbind_with_sig :: Maybe (LHsBind (GhcPass 'Renamed), TcIdSigInfo)
</span><a href="#local-6989586621681097726"><span class="hs-identifier hs-var hs-var">one_funbind_with_sig</span></a></span></span><span>
</span><span id="line-1694"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">[</span><span id="local-6989586621681097709"><span class="annot"><span class="annottext">lbind :: LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681097709"><span class="hs-identifier hs-var">lbind</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#FunBind"><span class="hs-identifier hs-type">FunBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">fun_id :: forall idL idR. HsBindLR idL idR -&gt; Located (IdP idL)
</span><a href="GHC.Hs.Binds.html#fun_id"><span class="hs-identifier hs-var">fun_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097708"><span class="annot"><span class="annottext">Located (IdP (GhcPass 'Renamed))
</span><a href="#local-6989586621681097708"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span class="hs-special">)</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LHsBind (GhcPass 'Renamed)]
</span><a href="#local-6989586621681097734"><span class="hs-identifier hs-var">lbinds</span></a></span><span>
</span><span id="line-1695"></span><span>      </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Tc.Types.html#TcIdSig"><span class="hs-identifier hs-type">TcIdSig</span></a></span><span> </span><span id="local-6989586621681097707"><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097707"><span class="hs-identifier hs-var">sig</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681097732"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Name -&gt; Name
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Name
Located (IdP (GhcPass 'Renamed))
</span><a href="#local-6989586621681097708"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1696"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LHsBind (GhcPass 'Renamed), TcIdSigInfo)
-&gt; Maybe (LHsBind (GhcPass 'Renamed), TcIdSigInfo)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
</span><a href="#local-6989586621681097709"><span class="hs-identifier hs-var">lbind</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TcIdSigInfo
</span><a href="#local-6989586621681097707"><span class="hs-identifier hs-var">sig</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1697"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1698"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (LHsBind (GhcPass 'Renamed), TcIdSigInfo)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-1699"></span><span>
</span><span id="line-1700"></span><span>    </span><span class="hs-comment">-- The Haskell 98 monomorphism restriction</span><span>
</span><span id="line-1701"></span><span>    </span><span id="local-6989586621681097712"><span class="annot"><span class="annottext">restricted :: HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed) -&gt; Bool
</span><a href="#local-6989586621681097712"><span class="hs-identifier hs-var hs-var">restricted</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#PatBind"><span class="hs-identifier hs-type">PatBind</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>                              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1702"></span><span>    </span><span class="annot"><a href="#local-6989586621681097712"><span class="hs-identifier hs-var">restricted</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#VarBind"><span class="hs-identifier hs-type">VarBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">var_id :: forall idL idR. HsBindLR idL idR -&gt; IdP idL
</span><a href="GHC.Hs.Binds.html#var_id"><span class="hs-identifier hs-var">var_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097704"><span class="annot"><span class="annottext">IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097704"><span class="hs-identifier hs-var">v</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>                  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="#local-6989586621681097703"><span class="hs-identifier hs-var">no_sig</span></a></span><span> </span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097704"><span class="hs-identifier hs-var">v</span></a></span><span>
</span><span id="line-1703"></span><span>    </span><span class="annot"><a href="#local-6989586621681097712"><span class="hs-identifier hs-var">restricted</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#FunBind"><span class="hs-identifier hs-type">FunBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">fun_id :: forall idL idR. HsBindLR idL idR -&gt; Located (IdP idL)
</span><a href="GHC.Hs.Binds.html#fun_id"><span class="hs-identifier hs-var">fun_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097702"><span class="annot"><span class="annottext">Located (IdP (GhcPass 'Renamed))
</span><a href="#local-6989586621681097702"><span class="hs-identifier hs-var">v</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fun_matches :: forall idL idR. HsBindLR idL idR -&gt; MatchGroup idR (LHsExpr idR)
</span><a href="GHC.Hs.Binds.html#fun_matches"><span class="hs-identifier hs-var">fun_matches</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097701"><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097701"><span class="hs-identifier hs-var">m</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed)) -&gt; Bool
forall {id :: Pass} {body}. MatchGroup (GhcPass id) body -&gt; Bool
</span><a href="#local-6989586621681097700"><span class="hs-identifier hs-var">restricted_match</span></a></span><span> </span><span class="annot"><span class="annottext">MatchGroup (GhcPass 'Renamed) (LHsExpr (GhcPass 'Renamed))
</span><a href="#local-6989586621681097701"><span class="hs-identifier hs-var">m</span></a></span><span>
</span><span id="line-1704"></span><span>                                                           </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="#local-6989586621681097703"><span class="hs-identifier hs-var">no_sig</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Name -&gt; Name
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Name
Located (IdP (GhcPass 'Renamed))
</span><a href="#local-6989586621681097702"><span class="hs-identifier hs-var">v</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1705"></span><span>    </span><span class="annot"><a href="#local-6989586621681097712"><span class="hs-identifier hs-var">restricted</span></a></span><span> </span><span id="local-6989586621681097699"><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681097699"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Bool
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;isRestrictedGroup/unrestricted&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed) -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681097699"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1706"></span><span>
</span><span id="line-1707"></span><span>    </span><span id="local-6989586621681097700"><span class="annot"><span class="annottext">restricted_match :: MatchGroup (GhcPass id) body -&gt; Bool
</span><a href="#local-6989586621681097700"><span class="hs-identifier hs-var hs-var">restricted_match</span></a></span></span><span> </span><span id="local-6989586621681097694"><span class="annot"><span class="annottext">MatchGroup (GhcPass id) body
</span><a href="#local-6989586621681097694"><span class="hs-identifier hs-var">mg</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">MatchGroup (GhcPass id) body -&gt; BKey
forall (id :: Pass) body. MatchGroup (GhcPass id) body -&gt; BKey
</span><a href="GHC.Hs.Expr.html#matchGroupArity"><span class="hs-identifier hs-var">matchGroupArity</span></a></span><span> </span><span class="annot"><span class="annottext">MatchGroup (GhcPass id) body
</span><a href="#local-6989586621681097694"><span class="hs-identifier hs-var">mg</span></a></span><span> </span><span class="annot"><span class="annottext">BKey -&gt; BKey -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">BKey
</span><span class="hs-number">0</span></span><span>
</span><span id="line-1708"></span><span>        </span><span class="hs-comment">-- No args =&gt; like a pattern binding</span><span>
</span><span id="line-1709"></span><span>        </span><span class="hs-comment">-- Some args =&gt; a function binding</span><span>
</span><span id="line-1710"></span><span>
</span><span id="line-1711"></span><span>    </span><span id="local-6989586621681097703"><span class="annot"><span class="annottext">no_sig :: Name -&gt; Bool
</span><a href="#local-6989586621681097703"><span class="hs-identifier hs-var hs-var">no_sig</span></a></span></span><span> </span><span id="local-6989586621681097692"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097692"><span class="hs-identifier hs-var">n</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TcSigFun -&gt; Name -&gt; Bool
</span><a href="GHC.Tc.Types.html#hasCompleteSig"><span class="hs-identifier hs-var">hasCompleteSig</span></a></span><span> </span><span class="annot"><span class="annottext">TcSigFun
</span><a href="#local-6989586621681097732"><span class="hs-identifier hs-var">sig_fn</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097692"><span class="hs-identifier hs-var">n</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1712"></span><span>
</span><span id="line-1713"></span><span class="annot"><a href="GHC.Tc.Gen.Bind.html#isClosedBndrGroup"><span class="hs-identifier hs-type">isClosedBndrGroup</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#TcTypeEnv"><span class="hs-identifier hs-type">TcTypeEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#Bag"><span class="hs-identifier hs-type">Bag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#LHsBind"><span class="hs-identifier hs-type">LHsBind</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#IsGroupClosed"><span class="hs-identifier hs-type">IsGroupClosed</span></a></span><span>
</span><span id="line-1714"></span><span id="isClosedBndrGroup"><span class="annot"><span class="annottext">isClosedBndrGroup :: TcTypeEnv -&gt; LHsBinds (GhcPass 'Renamed) -&gt; IsGroupClosed
</span><a href="GHC.Tc.Gen.Bind.html#isClosedBndrGroup"><span class="hs-identifier hs-var hs-var">isClosedBndrGroup</span></a></span></span><span> </span><span id="local-6989586621681097691"><span class="annot"><span class="annottext">TcTypeEnv
</span><a href="#local-6989586621681097691"><span class="hs-identifier hs-var">type_env</span></a></span></span><span> </span><span id="local-6989586621681097690"><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed)
</span><a href="#local-6989586621681097690"><span class="hs-identifier hs-var">binds</span></a></span></span><span>
</span><span id="line-1715"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NameEnv (UniqSet Name) -&gt; Bool -&gt; IsGroupClosed
</span><a href="GHC.Tc.Types.html#IsGroupClosed"><span class="hs-identifier hs-var">IsGroupClosed</span></a></span><span> </span><span class="annot"><span class="annottext">NameEnv (UniqSet Name)
</span><a href="#local-6989586621681097689"><span class="hs-identifier hs-var">fv_env</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681097688"><span class="hs-identifier hs-var">type_closed</span></a></span><span>
</span><span id="line-1716"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-1717"></span><span>    </span><span id="local-6989586621681097688"><span class="annot"><span class="annottext">type_closed :: Bool
</span><a href="#local-6989586621681097688"><span class="hs-identifier hs-var hs-var">type_closed</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(UniqSet Name -&gt; Bool) -&gt; NameEnv (UniqSet Name) -&gt; Bool
forall elt key. (elt -&gt; Bool) -&gt; UniqFM key elt -&gt; Bool
</span><a href="GHC.Types.Unique.FM.html#allUFM"><span class="hs-identifier hs-var">allUFM</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name -&gt; Bool) -&gt; UniqSet Name -&gt; Bool
</span><a href="GHC.Types.Name.Set.html#nameSetAll"><span class="hs-identifier hs-var">nameSetAll</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="#local-6989586621681097685"><span class="hs-identifier hs-var">is_closed_type_id</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">NameEnv (UniqSet Name)
</span><a href="#local-6989586621681097689"><span class="hs-identifier hs-var">fv_env</span></a></span><span>
</span><span id="line-1718"></span><span>
</span><span id="line-1719"></span><span>    </span><span class="annot"><a href="#local-6989586621681097689"><span class="hs-identifier hs-type">fv_env</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Env.html#NameEnv"><span class="hs-identifier hs-type">NameEnv</span></a></span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span>
</span><span id="line-1720"></span><span>    </span><span id="local-6989586621681097689"><span class="annot"><span class="annottext">fv_env :: NameEnv (UniqSet Name)
</span><a href="#local-6989586621681097689"><span class="hs-identifier hs-var hs-var">fv_env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[(Name, UniqSet Name)] -&gt; NameEnv (UniqSet Name)
forall a. [(Name, a)] -&gt; NameEnv a
</span><a href="GHC.Types.Name.Env.html#mkNameEnv"><span class="hs-identifier hs-var">mkNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">([(Name, UniqSet Name)] -&gt; NameEnv (UniqSet Name))
-&gt; [(Name, UniqSet Name)] -&gt; NameEnv (UniqSet Name)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(LHsBind (GhcPass 'Renamed) -&gt; [(Name, UniqSet Name)])
-&gt; LHsBinds (GhcPass 'Renamed) -&gt; [(Name, UniqSet Name)]
forall (t :: * -&gt; *) a b. Foldable t =&gt; (a -&gt; [b]) -&gt; t a -&gt; [b]
</span><a href="../../base/src/Data.Foldable.html#concatMap"><span class="hs-identifier hs-var">concatMap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
-&gt; [(Name, UniqSet Name)]
</span><a href="#local-6989586621681097682"><span class="hs-identifier hs-var">bindFvs</span></a></span><span> </span><span class="annot"><span class="annottext">(HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
 -&gt; [(Name, UniqSet Name)])
-&gt; (LHsBind (GhcPass 'Renamed)
    -&gt; HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed))
-&gt; LHsBind (GhcPass 'Renamed)
-&gt; [(Name, UniqSet Name)]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LHsBind (GhcPass 'Renamed)
-&gt; HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">LHsBinds (GhcPass 'Renamed)
</span><a href="#local-6989586621681097690"><span class="hs-identifier hs-var">binds</span></a></span><span>
</span><span id="line-1721"></span><span>
</span><span id="line-1722"></span><span>    </span><span class="annot"><a href="#local-6989586621681097682"><span class="hs-identifier hs-type">bindFvs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.Binds.html#HsBindLR"><span class="hs-identifier hs-type">HsBindLR</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Set.html#NameSet"><span class="hs-identifier hs-type">NameSet</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1723"></span><span>    </span><span id="local-6989586621681097682"><span class="annot"><span class="annottext">bindFvs :: HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
-&gt; [(Name, UniqSet Name)]
</span><a href="#local-6989586621681097682"><span class="hs-identifier hs-var hs-var">bindFvs</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#FunBind"><span class="hs-identifier hs-type">FunBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">fun_id :: forall idL idR. HsBindLR idL idR -&gt; Located (IdP idL)
</span><a href="GHC.Hs.Binds.html#fun_id"><span class="hs-identifier hs-var">fun_id</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681097681"><span class="annot"><span class="annottext">IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097681"><span class="hs-identifier hs-var">f</span></a></span></span><span>
</span><span id="line-1724"></span><span>                     </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">fun_ext :: forall idL idR. HsBindLR idL idR -&gt; XFunBind idL idR
</span><a href="GHC.Hs.Binds.html#fun_ext"><span class="hs-identifier hs-var">fun_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097680"><span class="annot"><span class="annottext">XFunBind (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681097680"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1725"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097679"><span class="annot"><span class="annottext">open_fvs :: UniqSet Name
</span><a href="#local-6989586621681097679"><span class="hs-identifier hs-var hs-var">open_fvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet Name -&gt; UniqSet Name
</span><a href="#local-6989586621681097678"><span class="hs-identifier hs-var">get_open_fvs</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet Name
XFunBind (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681097680"><span class="hs-identifier hs-var">fvs</span></a></span><span>
</span><span id="line-1726"></span><span>         </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
IdP (GhcPass 'Renamed)
</span><a href="#local-6989586621681097681"><span class="hs-identifier hs-var">f</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">UniqSet Name
</span><a href="#local-6989586621681097679"><span class="hs-identifier hs-var">open_fvs</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-1727"></span><span>    </span><span class="annot"><a href="#local-6989586621681097682"><span class="hs-identifier hs-var">bindFvs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Binds.html#PatBind"><span class="hs-identifier hs-type">PatBind</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">pat_lhs :: forall idL idR. HsBindLR idL idR -&gt; LPat idL
</span><a href="GHC.Hs.Binds.html#pat_lhs"><span class="hs-identifier hs-var">pat_lhs</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097677"><span class="annot"><span class="annottext">LPat (GhcPass 'Renamed)
</span><a href="#local-6989586621681097677"><span class="hs-identifier hs-var">pat</span></a></span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">pat_ext :: forall idL idR. HsBindLR idL idR -&gt; XPatBind idL idR
</span><a href="GHC.Hs.Binds.html#pat_ext"><span class="hs-identifier hs-var">pat_ext</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621681097676"><span class="annot"><span class="annottext">XPatBind (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681097676"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-1728"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681097675"><span class="annot"><span class="annottext">open_fvs :: UniqSet Name
</span><a href="#local-6989586621681097675"><span class="hs-identifier hs-var hs-var">open_fvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">UniqSet Name -&gt; UniqSet Name
</span><a href="#local-6989586621681097678"><span class="hs-identifier hs-var">get_open_fvs</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet Name
XPatBind (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><a href="#local-6989586621681097676"><span class="hs-identifier hs-var">fvs</span></a></span><span>
</span><span id="line-1729"></span><span>         </span><span class="hs-keyword">in</span><span> </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097674"><span class="hs-identifier hs-var">b</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">UniqSet Name
</span><a href="#local-6989586621681097675"><span class="hs-identifier hs-var">open_fvs</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621681097674"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097674"><span class="hs-identifier hs-var">b</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Renamed) -&gt; [IdP (GhcPass 'Renamed)]
forall p. CollectPass p =&gt; LPat p -&gt; [IdP p]
</span><a href="GHC.Hs.Utils.html#collectPatBinders"><span class="hs-identifier hs-var">collectPatBinders</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass 'Renamed)
</span><a href="#local-6989586621681097677"><span class="hs-identifier hs-var">pat</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-1730"></span><span>    </span><span class="annot"><a href="#local-6989586621681097682"><span class="hs-identifier hs-var">bindFvs</span></a></span><span> </span><span class="annot"><span class="annottext">HsBindLR (GhcPass 'Renamed) (GhcPass 'Renamed)
</span><span class="hs-identifier">_</span></span><span>
</span><span id="line-1731"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-1732"></span><span>
</span><span id="line-1733"></span><span>    </span><span id="local-6989586621681097678"><span class="annot"><span class="annottext">get_open_fvs :: UniqSet Name -&gt; UniqSet Name
</span><a href="#local-6989586621681097678"><span class="hs-identifier hs-var hs-var">get_open_fvs</span></a></span></span><span> </span><span id="local-6989586621681097673"><span class="annot"><span class="annottext">UniqSet Name
</span><a href="#local-6989586621681097673"><span class="hs-identifier hs-var">fvs</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Bool) -&gt; UniqSet Name -&gt; UniqSet Name
</span><a href="GHC.Types.Name.Set.html#filterNameSet"><span class="hs-identifier hs-var">filterNameSet</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">(Bool -&gt; Bool) -&gt; (Name -&gt; Bool) -&gt; Name -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Bool
</span><a href="#local-6989586621681097671"><span class="hs-identifier hs-var">is_closed</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">UniqSet Name
</span><a href="#local-6989586621681097673"><span class="hs-identifier hs-var">fvs</span></a></span><span>
</span><span id="line-1734"></span><span>
</span><span id="line-1735"></span><span>    </span><span class="annot"><a href="#local-6989586621681097671"><span class="hs-identifier hs-type">is_closed</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#ClosedTypeId"><span class="hs-identifier hs-type">ClosedTypeId</span></a></span><span>
</span><span id="line-1736"></span><span>    </span><span id="local-6989586621681097671"><span class="annot"><span class="annottext">is_closed :: Name -&gt; Bool
</span><a href="#local-6989586621681097671"><span class="hs-identifier hs-var hs-var">is_closed</span></a></span></span><span> </span><span id="local-6989586621681097669"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097669"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-1737"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681097668"><span class="annot"><span class="annottext">TcTyThing
</span><a href="#local-6989586621681097668"><span class="hs-identifier hs-var">thing</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcTypeEnv -&gt; Name -&gt; Maybe TcTyThing
forall a. NameEnv a -&gt; Name -&gt; Maybe a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv"><span class="hs-identifier hs-var">lookupNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcTypeEnv
</span><a href="#local-6989586621681097691"><span class="hs-identifier hs-var">type_env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097669"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1738"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyThing
</span><a href="#local-6989586621681097668"><span class="hs-identifier hs-var">thing</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1739"></span><span>          </span><span class="annot"><a href="GHC.Tc.Types.html#AGlobal"><span class="hs-identifier hs-type">AGlobal</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span>                     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1740"></span><span>          </span><span class="annot"><a href="GHC.Tc.Types.html#ATcId"><span class="hs-identifier hs-type">ATcId</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tct_info :: TcTyThing -&gt; IdBindingInfo
</span><a href="GHC.Tc.Types.html#tct_info"><span class="hs-identifier hs-var">tct_info</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdBindingInfo
</span><a href="GHC.Tc.Types.html#ClosedLet"><span class="hs-identifier hs-var">ClosedLet</span></a></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-1741"></span><span>          </span><span class="annot"><span class="annottext">TcTyThing
</span><span class="hs-identifier">_</span></span><span>                              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1742"></span><span>
</span><span id="line-1743"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1744"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>  </span><span class="hs-comment">-- The free-var set for a top level binding mentions</span><span>
</span><span id="line-1745"></span><span>
</span><span id="line-1746"></span><span>
</span><span id="line-1747"></span><span>    </span><span class="annot"><a href="#local-6989586621681097685"><span class="hs-identifier hs-type">is_closed_type_id</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-1748"></span><span>    </span><span class="hs-comment">-- We're already removed Global and ClosedLet Ids</span><span>
</span><span id="line-1749"></span><span>    </span><span id="local-6989586621681097685"><span class="annot"><span class="annottext">is_closed_type_id :: Name -&gt; Bool
</span><a href="#local-6989586621681097685"><span class="hs-identifier hs-var hs-var">is_closed_type_id</span></a></span></span><span> </span><span id="local-6989586621681097663"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097663"><span class="hs-identifier hs-var">name</span></a></span></span><span>
</span><span id="line-1750"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681097662"><span class="annot"><span class="annottext">TcTyThing
</span><a href="#local-6989586621681097662"><span class="hs-identifier hs-var">thing</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">TcTypeEnv -&gt; Name -&gt; Maybe TcTyThing
forall a. NameEnv a -&gt; Name -&gt; Maybe a
</span><a href="GHC.Types.Name.Env.html#lookupNameEnv"><span class="hs-identifier hs-var">lookupNameEnv</span></a></span><span> </span><span class="annot"><span class="annottext">TcTypeEnv
</span><a href="#local-6989586621681097691"><span class="hs-identifier hs-var">type_env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097663"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-1751"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">TcTyThing
</span><a href="#local-6989586621681097662"><span class="hs-identifier hs-var">thing</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-1752"></span><span>          </span><span class="annot"><a href="GHC.Tc.Types.html#ATcId"><span class="hs-identifier hs-type">ATcId</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tct_info :: TcTyThing -&gt; IdBindingInfo
</span><a href="GHC.Tc.Types.html#tct_info"><span class="hs-identifier hs-var">tct_info</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><a href="GHC.Tc.Types.html#NonClosedLet"><span class="hs-identifier hs-type">NonClosedLet</span></a></span><span> </span><span class="annot"><span class="annottext">UniqSet Name
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681097660"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681097660"><span class="hs-identifier hs-var">cl</span></a></span></span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621681097660"><span class="hs-identifier hs-var">cl</span></a></span><span>
</span><span id="line-1753"></span><span>          </span><span class="annot"><a href="GHC.Tc.Types.html#ATcId"><span class="hs-identifier hs-type">ATcId</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">tct_info :: TcTyThing -&gt; IdBindingInfo
</span><a href="GHC.Tc.Types.html#tct_info"><span class="hs-identifier hs-var">tct_info</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IdBindingInfo
</span><a href="GHC.Tc.Types.html#NotLetBound"><span class="hs-identifier hs-var">NotLetBound</span></a></span><span> </span><span class="hs-special">}</span><span>       </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1754"></span><span>          </span><span class="annot"><a href="GHC.Tc.Types.html#ATyVar"><span class="hs-identifier hs-type">ATyVar</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span>                              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-1755"></span><span>               </span><span class="hs-comment">-- In-scope type variables are not closed!</span><span>
</span><span id="line-1756"></span><span>          </span><span class="annot"><span class="annottext">TcTyThing
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; SDoc -&gt; Bool
forall a. HasCallStack =&gt; String -&gt; SDoc -&gt; a
</span><a href="GHC.Utils.Outputable.html#pprPanic"><span class="hs-identifier hs-var">pprPanic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;is_closed_id&quot;</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681097663"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1757"></span><span>
</span><span id="line-1758"></span><span>      </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-1759"></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>   </span><span class="hs-comment">-- The free-var set for a top level binding mentions</span><span>
</span><span id="line-1760"></span><span>               </span><span class="hs-comment">-- imported things too, so that we can report unused imports</span><span>
</span><span id="line-1761"></span><span>               </span><span class="hs-comment">-- These won't be in the local type env.</span><span>
</span><span id="line-1762"></span><span>               </span><span class="hs-comment">-- Ditto class method etc from the current module</span><span>
</span><span id="line-1763"></span><span>
</span><span id="line-1764"></span><span>
</span><span id="line-1765"></span><span class="hs-comment">{- *********************************************************************
*                                                                      *
               Error contexts and messages
*                                                                      *
********************************************************************* -}</span><span>
</span><span id="line-1770"></span><span>
</span><span id="line-1771"></span><span class="hs-comment">-- This one is called on LHS, when pat and grhss are both Name</span><span>
</span><span id="line-1772"></span><span class="hs-comment">-- and on RHS, when pat is TcId and grhss is still Name</span><span>
</span><span id="line-1773"></span><span id="local-6989586621681099067"><span id="local-6989586621681099068"><span class="annot"><a href="GHC.Tc.Gen.Bind.html#patMonoBindsCtxt"><span class="hs-identifier hs-type">patMonoBindsCtxt</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#OutputableBndrId"><span class="hs-identifier hs-type">OutputableBndrId</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099068"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#Outputable"><span class="hs-identifier hs-type">Outputable</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099067"><span class="hs-identifier hs-type">body</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1774"></span><span>                 </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Pat.html#LPat"><span class="hs-identifier hs-type">LPat</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPass"><span class="hs-identifier hs-type">GhcPass</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099068"><span class="hs-identifier hs-type">p</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Hs.Expr.html#GRHSs"><span class="hs-identifier hs-type">GRHSs</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcRn"><span class="hs-identifier hs-type">GhcRn</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681099067"><span class="hs-identifier hs-type">body</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span></span></span><span>
</span><span id="line-1775"></span><span id="patMonoBindsCtxt"><span class="annot"><span class="annottext">patMonoBindsCtxt :: forall (p :: Pass) body.
(OutputableBndrId p, Outputable body) =&gt;
LPat (GhcPass p) -&gt; GRHSs (GhcPass 'Renamed) body -&gt; SDoc
</span><a href="GHC.Tc.Gen.Bind.html#patMonoBindsCtxt"><span class="hs-identifier hs-var hs-var">patMonoBindsCtxt</span></a></span></span><span> </span><span id="local-6989586621681097649"><span class="annot"><span class="annottext">LPat (GhcPass p)
</span><a href="#local-6989586621681097649"><span class="hs-identifier hs-var">pat</span></a></span></span><span> </span><span id="local-6989586621681097648"><span class="annot"><span class="annottext">GRHSs (GhcPass 'Renamed) body
</span><a href="#local-6989586621681097648"><span class="hs-identifier hs-var">grhss</span></a></span></span><span>
</span><span id="line-1776"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; BKey -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hang"><span class="hs-identifier hs-var">hang</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;In a pattern binding:&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">BKey
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LPat (GhcPass p) -&gt; GRHSs (GhcPass 'Renamed) body -&gt; SDoc
forall (bndr :: Pass) (p :: Pass) body.
(OutputableBndrId bndr, OutputableBndrId p, Outputable body) =&gt;
LPat (GhcPass bndr) -&gt; GRHSs (GhcPass p) body -&gt; SDoc
</span><a href="GHC.Hs.Expr.html#pprPatBind"><span class="hs-identifier hs-var">pprPatBind</span></a></span><span> </span><span class="annot"><span class="annottext">LPat (GhcPass p)
</span><a href="#local-6989586621681097649"><span class="hs-identifier hs-var">pat</span></a></span><span> </span><span class="annot"><span class="annottext">GRHSs (GhcPass 'Renamed) body
</span><a href="#local-6989586621681097648"><span class="hs-identifier hs-var">grhss</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-1777"></span></pre></body></html>